Re: respondsToSelector - #import OR compiler warnings?
Re: respondsToSelector - #import OR compiler warnings?
- Subject: Re: respondsToSelector - #import OR compiler warnings?
- From: Ken Thomases <email@hidden>
- Date: Tue, 30 Dec 2008 01:00:52 -0600
On Dec 30, 2008, at 12:06 AM, Steve Cronin wrote:
Ken - I don't understand what you said about the method's
signature's compliance with NSObject _protocol_.
I looked at the protocol definition in the documentation and I just
don't understand well enough to see what I could do to "side-step"
the warnings,
Would you be willing to spend another sentence or two on that?
Sure. Sorry if I was unclear.
First, I only underlined "protocol" to make sure you looked in the
right place in the documentation. The -performSelector:... methods
are documented as part of the NSObject protocol, not the NSObject class.
Second, the documentation for the -performSelector: method says the
following:
The aSelector argument should identify a method that takes no
arguments. For methods that return anything other than an object,
useNSInvocation.
That's saying that the selector you pass to -performSelector: should
be for a method which takes no arguments and returns an object
pointer. This -- the number and types of arguments and return type --
is the "signature" of the method.
The -performSelector:withObject: and -
performSelector:withObject:withObject: methods similarly describe the
signature requirements for the method identified by the selector you
pass.
So, if you are working with a selector for a method which matches the
signature required by one of those methods, then you can safely use
those methods. Doing so is a way to invoke the method without getting
the compiler warning that was troubling you.
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden