peterchen149 2015-09-30 01:17 采纳率: 0%
浏览 1618

没有预编译文件prefix.pch的情况下怎么在发布版中去除NSLog?

在网上搜了一下,都是说在prefix.pch文件里加上这么一段

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

我现在的项目都不用prefix.pch了,有没有其他的办法?

  • 写回答

2条回答

  • 依然灬范特西 2015-09-30 02:11
    关注

    你可以自定义一个打印输出 比如说叫MYLog(),然后
    #ifdef DEBUG
    NSlog(@"123");
    #else
    //什么都不输出就行了
    #endif

    评论

报告相同问题?