Anyway to get string from variable name?

As easy as

#define VariableName(arg) (@""#arg)

Then you do:

NSObject *obj;
NSString *str = VariableName(obj);
NSLog(@"STR %@", str);//obj

Leave a Comment