Any way to ask a method for its name?

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-04-22T02:00:28Z Indexed on 2010/04/22 2:03 UTC
Read the original article Hit count: 222

Filed under:
|
|

I'm trying to debug an iPhone app I'm working on, and the idea of adding fifty NSLog statements to the various source files gives me the willies.

What I'd like to do is write a pair of statements, say

NSString *methodName = [self methodName];
NSLog(@"%@", methodName);

that I can just paste into each method I need to. Is there a way to do this? Is there some Objective-C construct for asking a method for its name? Or am I gonna have to do this the hard way?

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about objective-c