NSLog 去除上线版本

创建pch 文件

STEP1:

#ifdef DEBUG

#   define NSLog(...) NSLog(__VA_ARGS__)

#else

#   define NSLog(...)

#endif

#define ALog(...)  NSLog(__VA_ARGS__)

 

STEP2:

a. TARGETS 中 Build Settings 设置 Apple LLVM7.1 - Preprocessing 里面 Preprocessor Macros ;

如果在测试版本打印日志,Debug 填写 Debug  ; Relase 不填写

如果在上线版本打印日志,Release填写 Relase ; Debug 不填写

b.PROJECT 一样 在相同的位置设置相对应功能;

 

原文地址:https://www.cnblogs.com/tony0571/p/5793776.html