Sidyll's answer works, but there is a better solution.
Typically, you should declare a protocol:
@protocol MyOptionalMethods
@optional
- (void)method:(NSDictionary*)dict;
@end
And declare that your object conforms to the protocol:
id<MyOptionalMethods> foo;
UIView*<MyOptionalMethods> bar;
Then check:
if ([foo respondsToSelector:@selector(method:)])
[foo method: dict];
Thus, the compiler has the ability to completely print all the arguments. In addition, this pattern is not limited to methods that take no arguments or a single argument from an object.
, ARC ( ARC performSelector:).