How to get caller if the function has no -sender parameter?
For example, there are functions named -(void)Foo
, and -(void)Foo:(id)sender
.
The -(void)Foo:(id)sender
can get the caller from parameter, and my question is, how to get caller from -(void)Foo
? Is t开发者_如何学Gohere any way to get the caller?
Please have a look at Objective C find caller of method. For what do you need it? The (id)sender parameter is passed directly by the method sending the message, there is no magic involved.
精彩评论