I have a protocol and an object that conforms to that protocol referenced by an ivar:

@protocol FKPointArraySourcing
-(NSInteger)fooMethod;
@end

@interface FKObject : NSObject <FKPointArraySourcing> {
 id <FKPointArraySourcing> mGrid; 
}

If I attempt to retain the ivar like this:

[mGrid retain];

then I get a warning that "-retain was not found in protocol(s)".

If I change the protocol definition to:

@protocol FKPointArraySourcing <NSObject>
-(NSInteger)foo;
@end

then the warning goes away.

If I remove the protocol conformance and just use a naked id, then the warning goes away as well.

Or if I cast mGrid to id the warning goes away.

Why is this addition needed? I don't see it used in other code. It's as though the compiler believes that conformance to a protocol implies that it exclusively provides those methods, which is not the idea of protocol conformance at all.




Steve Weller   [EMAIL PROTECTED]
Technical Writing, Editing, Developer Guides, and a little Cocoa



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to