Using NSStringFromSelector to convert the selectos into a NSString, and the print the object:
NSLog(@"%@", NSStringFromSelector(selector) );
Or print it directly with good, old-fashioned C:
NSLog(@"%s", selector,);
Using NSStringFromSelector to convert the selectos into a NSString, and the print the object:
NSLog(@"%@", NSStringFromSelector(selector) );
Or print it directly with good, old-fashioned C:
NSLog(@"%s", selector,);
int x = 11; [NSString stringWithFormat:@"%03i", x]; // @"011" [NSString stringWithFormat:@"%+5i", x]; // @"+++11" [NSString stringWithFormat:@"%+05i", x]; // @"+0011"
And not really like that. 381. I’ll still have to learn a lot of C.
Add the the *_Prefix.pch file of your projects. Strips out NSLogs, when optimized (=Release Build)
Very nice solution, thanks to Marek Bell
// strip out NSLog on optimize #ifndef __OPTIMIZE__ # define NSLog(...) NSLog(__VA_ARGS__) #else # define NSLog(...) {} #endif
float f = 1.23456; NSLog(@"%.2f", f); NSLog(@"%.0f", f); NSLog(@"%.0f", f);
1.23
1
1.23456
Turning Boolean 1, 0 into a more descriptive description:
NSLog(@”data1 is equal to data2: %@”, [data1 isEqualToData:data2] ? @”YES” : @”NO”);
287[^//]NSLog
Looking Projectwide for NSLog’s:
Shift-Apple-F: [^//]NSLog
All the NSLogs, which don’t have // infront of them.
Update:
This might be a more elegant way to get rid of the NSLogs. 447
comment find NSLog regexp search
484Printing Selectors in NSLog 452Padding with Zeros (or other characters) 447Stripping out NSLog() from the Release Build 376Variable length of accuracy of float in NSString 218Obj-C, Shortcut: Boolean return value to String