【发布时间】:2016-10-26 06:54:54
【问题描述】:
我有 3 个目标。假设 TargetA、TargetB 和 TargetC。我在 Targets > Target name > Build Settings > Apple LLVM 7.1 - Custom Compiler Flags > Other C Flags > Debug & Release 中为每个目标添加了不同的编译器指令。
我把-dTargetA放在TargetA上,-dTargetB放在TargetB上,-dTargetC放在TargetC上。然后我在 AppDelegate 的 didFinishLaunchingWithOptions 上有这段代码:
#if TargetA
print ("TargetA");
#else
#if TargetB
print ("TargetB");
#else
#if TargetC
print ("TargetC");
#else
print ("Not Recognised");
#endif
#endif
#endif
但是当我运行它时,我在输出控制台上看到“未识别”,即使我从任何目标运行。怎么了?谢谢。
【问题讨论】:
标签: ios swift compiler-directives