方法1.点击xcode工程,有个Build settings 的选项,在这里有个Apple LLVM 5.1 preprocessing的选项,里面有个preprocess Macros添加自定义的预编译宏就可以了
方法2.在xxx.pch文件添加。
#ifdef _NDEBUG
#define DMLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#else
#define DMLog(...) do { } while (0)
#endif
这样就能生效了