Following on from my last post we now have a “Debug” build scheme so we should put it to good use. One of the things I do when I want to visually see whats going on in my apps and I don’t want to have to mess with the debugger all the time, I add some NSLogs, but I don’t want these to be in the Release/Distribution versions of the app. So I add this to one of my .h files that gets included everywhere (I normally pick *_Prefix.h):
Author: Simon Coggins
Description: This is the maro I use to add debugging output to my apps. It is
enabled when -DDEBUG is defined, but when it's not, all the debug code is removed.
#define ZDebug(fmt, args...) NSLog(@"[%s:%d] %@\n", basename(__FILE__), __LINE__, [NSString stringWithFormat:fmt, ##args])
#define ZDebug(fmt, args...) ((void)0)
This will log to the console messages in the console while in -Debug, but if you change to -Testflight or -AppStore the debugging output will go away.