Interrogating selectors at runtime
Interrogating selectors at runtime
- Subject: Interrogating selectors at runtime
- From: Andrew White <email@hidden>
- Date: Mon, 06 Feb 2006 10:58:21 +1100
Given a data entry of type SEL, is there an easy way to find out how many
arguments it expects at runtime?
Obviously, I can go NSStringFromSelector (aSelector) and then count the
number of ':' characters, but that's expensive and clunky. Is there a
better way?
A related question: what happens if I call 'performSelector:withObject' on
a selector that takes no arguments, or
'performSelector:withObject:withObject' on a selector that takes only one?
Are the surplus arguments harmlessly discarded?
eg:
SEL aSelector = @selector (myMethod:)
[aClassInstance performSelector: aSelector
withObject: anObject
withObject: anotherObject
];
Will this harmlessly perform [aClassInstance myMethod: anObject] or will
errors result?
Thanks
--
Andrew White
--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden