How to get the name of a class of a method as NSString?
cocoa-touch, iphone, uikit
Solution
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]);
Problem
I need the name of the class that owns a method, as `NSString`. Example: There's a `-fooBar` method inside a `SomeClass`, and that `-fooBar` method runs some code. This code must print out what class "owns" it, I mean: What class that method belongs to. So I can't hard-type the class name in a `NSString` because I need that for debugging purposes, determining dynamically the name of the class. Hard to explain. Any idea?