[IPhone] 仅在Debug编译的NSLog

一般在开发的时候,会使用NSLog来输出一些除错讯息到Console视窗
但是如果仅用NSLog的话
首先利用下面代码
#ifdefDEBUG #defineDebugLog(log,...)NSLog(log,##__VA_ARGS__) #undefDebugLog #defineDebugLog(log)NSLog(log) #else #defineDebugLog(log,...) #undefDebugLog #defineDebugLog(log)NSLog(log) #endif

在Xcode的Project=>Edit Active Target "MyProject" 开启编辑画面
GCC_PREPROCESSOR_DEFINITIONS中加入DEBUG
如果没有GCC_PREPROCESSOR_DEFINITIONS则自行建立
[IPhone] 仅在Debug编译的NSLog

相关文章:

  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-02-24
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案