On Dec 29, 2008, at 9:09 PM, Ken Thomases wrote:
To be clear, it's not the -respondsToSelector: expressions that are causing the warnings, it's the eventual invocations of the methods when you decide that some object does respond to them.

If the method satisfies the signature requirements of one of the - performSelector:... methods (defined in the NSObject _protocol_), then you can use those to side-step the compiler warning.

Right -- or you can declare the methods somewhere and then import them.

I would suggest looking at various patterns within the AppKit and Foundation that do this kind of thing. In particular, anything that implements a delegate of some kind will typically declare an informal interface on NSObject like this:

@interface NSObject (MyClassOptionalMethodsThatMightBeImplementedByJustAboutAnything)
- (void) someSpecial: (Sauce *) aSauce;
- (BOOL) isBobYourUncle: (Child *) aChild;
@end

As long as the header containing the above is imported, then invocations of the methods declared will never generate a warning (as long as said methods are implemented on a subclass of NSObject, anyway).

b.bum

_______________________________________________

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

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

Reply via email to