如何在#ifdef 中编写if 条件。用于分期。在 Objective-C 中
我需要在此调用中添加一个条件暂存..
如何在这种情况下执行此操作。
#ifdef MYAPP_PRODUCTION
buildMode = @"Production";
#else
#ifdef MYAPP_RELEASE
buildMode = @"Release";
#else MYAPP_DEBUG
buildMode = @"Debug";
#endif
#endif
另一个是 MyApp_Staging
需要在此 if 条件中包含如何做到这一点?
I need to add one more condition inside this call Staging..
how to do it in this condition.
#ifdef MYAPP_PRODUCTION
buildMode = @"Production";
#else
#ifdef MYAPP_RELEASE
buildMode = @"Release";
#else MYAPP_DEBUG
buildMode = @"Debug";
#endif
#endif
another is MyApp_Staging
need to include in this if condition how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以执行类似的操作来包含所有不同的选项,包括新的暂存模式,并使整个语句更清晰:
You could do something like this to contain all the different options including the new Staging Mode and make the whole statement cleaner:
你的问题不是很清楚......如果你想在 #ifdef 中使用多个条件,这里有一个解决方案:
Your question is not very clear... If you want multiple conditions in a #ifdef, here is a solution:
在 Swift 和 Xcode 7 中,语法发生了变化:
In Swift and Xcode 7, the syntax has changed:
如果您想用 2 个构建目标来否定条件,请像这样使用。
#if !(TOWNTALK || EPISD)
In case if you want to negate the condition with 2 build targets, use like this.
#if !(TOWNTALK || EPISD)
这又如何呢?
What about this?