On Jan 22, 2013, at 9:23 AM, Dave <d...@looktowindward.com> wrote:

>> You could try declaring initWithManager: in a category on the class visible 
>> only to your implementation code. (i.e. at the top of your .m file)
> 
> The class name is passed in as a string and the class is formed from that, so 
> I can't pre-declare it. Please see my other reply.

Sure you can:

@interface SomeFictionalClassName
- (id) initWithManager: (Foo*)manager;
@end

Put that at the top of your source file and the warning will go away, because 
the compiler is now confident that there exists an -initWithManager: method. 
(The fact that you’ve declared it on a completely fictional class doesn’t 
matter.)

As others have said, though, it really sounds like what you want is a protocol 
that defines the -initWithManager: method. This is a better solution because it 
adds more type-safety — if you ever rename -initWithManager:, but don’t fix all 
the places it’s used, the compiler will then be able to complain about the 
places you missed, so you’ll avoid confusing runtime errors.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to