Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the name of a class of a method as NSString?

On the Mac, you can use:

NSString *className = [self className];

or

NSString *className = NSStringFromClass([self class]);

On the iPhone, [self className] doesn't exist so you'll have to use:

NSString *className = NSStringFromClass([self class]);

NSLog(@"%@",[self className]);

Update: sorry, I didn't realize className didn't exist on the iPhone. As the above comment suggested; use ..

NSLog(@"%@", NSStringFromClass([self class]));

.. instead.


Try:

[[self class] description]