iOS Disable NSLog

spilakalb

macrumors member
Original poster
Sep 23, 2012
40
0
I found below code for disable/enable NSLog..In which file I place this code for testing..Appdelegate /main/etc....??

Code:
#if !defined(DEBUG) || !(TARGET_IPHONE_SIMULATOR)
    #define NSLog(...)
#endif
 
Last edited by a moderator:

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
This should go in your PCH file :)
We use something called DLog, which shows you the class + method + line that called the log, really usefull in big apps, and it doesn't include at compile time neither.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I use this. It allows you to have NSLog() independent of DebugLog(). It goes in the pch file.

Code:
#ifdef DEBUG
#define DebugLog(s, ...) NSLog(s, ##__VA_ARGS__)
#else
#define DebugLog(s, ...)
#endif
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.