美文网首页
iOS 解决Xcode 8 和 9 NSLog打印不全的问题

iOS 解决Xcode 8 和 9 NSLog打印不全的问题

作者: WLZero | 来源:发表于2017-10-09 17:39 被阅读188次

在项目中的.pch文件中添加如下代码即可解决:

#ifdef DEBUG //调试

#define NSLog(FORMAT, ...) fprintf(stderr, "%s:%zd\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String]);

#else // 发布

#define NSLog(FORMAT, ...) nil

#endif

相关文章

网友评论

      本文标题:iOS 解决Xcode 8 和 9 NSLog打印不全的问题

      本文链接:https://www.haomeiwen.com/subject/xtmpyxtx.html