For example, I want to trace the actions sent to my canPeformAction and they are too numerous to display at each occurrence with a "hover" in the debugger. Therefore, I want to trace to the log and examine it after my test cycle.
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
NSLog(@"%s: sender=%@", __FUNCTION__, sender, action);
}
You want
NSLog(@"%s: sender=%@, selector=%s", __FUNCTION__, sender,sel_getName(action));
Use NSStringFromSelector to easily get a printable name of the Selector.
NSStringFromSelector(action)
NSString * NSStringFromSelector ( SEL aSelector );
Returns a string representation of a given selector.
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
NSLog(@"Action: %@", NSStringFromSelector(action));
}
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