description of message that triggered a method invocation
问题 Does the objective-c runtime allow getting a description of the message that triggered a method invocation - from within that method itself? For example, if I have a method called: -(Foobar)doMyStuff; . . is it possible from within that method to get something like: //This would return @"doMyStuff" NSString* selectorName = [foobar nameOfMessageThatTriggeredMyInvocation]; 回答1: Yes. Every method has its selector passed in as a hidden argument. It's the second argument, after self , and it is