简体   繁体   English

在代码xcode iOS目标C中禁用DLogs

[英]Disable DLogs in the code xcode iOS objective c

**Basically, I have the DLog command in my project, i have almost hundreds of them. **基本上,我的项目中有DLog命令,我几乎有数百个。 No i am building a release build and i want the compiler to ignore all my DLogs. 不,我正在构建发行版本,并且我希望编译器忽略我的所有DLog。 One way i think of is go to every line where this DLog is and put an if condition only DLog 我想到的一种方法是转到此DLog所在的每一行,然后将if条件仅作为DLog

 if(Debug) {DLog(.....)}

I am wondering is there a one place i can make the compiler ignore all these DLogs for release?** 我想知道是否有一个地方可以让编译器忽略所有这些发布的DLog?**

Where you defined the DLog add an compiler directive : 在定义DLog的位置添加一个编译器指令:

#ifndef DLog
#   ifdef DEBUG
#       define DLog(...) NSLog(__VA_ARGS__)
#   else
#       define DLog( ...)
#   endif // NDEBUG
#endif // DLog

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM