Is there a preprocessor macro that expands to the current selector? [duplicate]
-
12-11-2019 - |
Pregunta
Possible Duplicate:
Dynamically retrieving current method's name
Obj-C introspection: How can a method reference it's own selector?
This applies to Objective-C, is there a preprocessor macro or something to get the SEL value of the current selector? Specifically I'm looking for something like:
-(void) someSelector
{
SEL mySelector = __CURRENT_SELECTOR__;
NSLog(@"I'm in selector %@",NSStringFromSelector(mySelector));
}
it's kinda like the __FILE__
macro but this to obtain the current selector. Pretty useful to pass it to others while not worrying to update it if the selector name is changed.
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow