How can I check the signature of the selector, or whether the selector requires parameters or not?
E.g. I want to check whether the selector is of type -(void) method
or-(void) method:(id)param
You can get a lot of information about a particular selector with the NSMethodSignature
class:
id obj = ...
SEL selector = ...
NSMethodSignature *signature = [obj methodSignatureForSelector:selector];
NSUInteger args = [signature numberOfArguments];
int i;
for(i = 0; i < args; i++)
printf("argument type at index %d: %c", i, [signature getArgumentTypeAtIndex:i]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With