• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?


  • Subject: Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 11 Jul 2011 00:35:01 -0700

On Jul 11, 2011, at 00:21, G S wrote:

> GetItemsOperation* getItemsOp = [[GetItemsOperation alloc]
> initWithContainer:_itemList];
>
> Jumping to the definition of GetItemsOperation goes to the right
> source, but jumping to initWithContainer goes to the wrong one.  While
> both objects are derived from NSOperation, the source files are
> formatted correctly (@end is present) and have different class names.
> The init functions have different parameters, although the first one
> is of the same class.  The incorrect source file defines the parameter
> as a pointer, while the correct one takes a reference.  The compiler
> complained because it was incorrectly trying to convert to a pointer.

If you check the documentation for 'alloc', you'll see that its return type is 'id'. This gives the compiler no help in deciding which of several incompatible declarations of the 'initWithContainer:' method to choose. You have an ambiguous method signature for selector 'initWithContainer:', and that isn't allowed.

Your best solution is to change both 'initWithContainer:' method names to distinguish the parameter types.

Or, change both the 'initWithContainer:' methods to take a parameter of type 'id'.

Or, cast the return value from 'alloc' to the correct subclass type.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
      • From: Jens Alfke <email@hidden>
References: 
 >Xcode is confusing two source files in the middle of a line. Anybody seen this? (From: G S <email@hidden>)

  • Prev by Date: Xcode is confusing two source files in the middle of a line. Anybody seen this?
  • Next by Date: Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
  • Previous by thread: Xcode is confusing two source files in the middle of a line. Anybody seen this?
  • Next by thread: Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
  • Index(es):
    • Date
    • Thread