disable NSLog

在.pch里添加:

 #ifdef DEBUG_MODE
  #define NSLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )

#else
  #define NSLog( s, ... )

#endif

然后debug 的get info 里preprocessor macros DEBUG_MODE = 1

 

方法二:

直接在.pch里添加:

#ifndef __OPTIMIZE__
#    define NSLog(...) NSLog(__VA_ARGS__)
#else
#    define NSLog(...) {}
#endif

即可

 

posted on 2011-07-13 10:03  fairycao  阅读(206)  评论(0)    收藏  举报