Skip to content

Instantly share code, notes, and snippets.

@acoomans
Created August 2, 2012 23:01
Show Gist options
  • Select an option

  • Save acoomans/87e791a0553c96d03340 to your computer and use it in GitHub Desktop.

Select an option

Save acoomans/87e791a0553c96d03340 to your computer and use it in GitHub Desktop.
Check method arguments type
BOOL supportedMethod = YES;
NSMethodSignature *methodSignature = [object methodSignatureForSelector:selector];
for (int i=0; i<[methodSignature numberOfArguments]; i++) {
if (
strcmp(@encode(id), [methodSignature getArgumentTypeAtIndex:i]) != 0 &&
strcmp(@encode(NSString*), [methodSignature getArgumentTypeAtIndex:i]) != 0
) {
supportedMethod = NO;
NSLog(@"NOT supportedMethod: %@", methodSignature);
return supportedMethod;
}
}
@acoomans

acoomans commented Aug 2, 2012

Copy link
Copy Markdown
Author

UNTESTED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment