swift如何判断debug模式和release模式

/ Mac / 没有评论 / 2010浏览

swift如何判断debug模式和release模式

在target下 Build Settings 搜索 Other Swift Flags.设置Debug 添加 -D DEBUG,注意不要好Release一起添加。使用方式和oc下一样

#if DEBUG // 判断是否在测试环境下
    // TODO
#else
    // TODO
#endif