Re: Xcode is confusing two source files in the middle of a line. Anybody seen this?
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