Ios 使用预处理器宏测试选定目标
我想用预处理器宏测试选定的目标。有人有主意吗Ios 使用预处理器宏测试选定目标,ios,xcode,macros,preprocessor,Ios,Xcode,Macros,Preprocessor,我想用预处理器宏测试选定的目标。有人有主意吗 #if TARGET1 #myVar @"aValue" #elsif TARGET2 #myVar @"anotherValue" #endif 提前谢谢你 有关特定目标和“预处理器宏”选项,请参见xcode项目中的“生成设置”选项卡。您可以在此处定义宏并在代码中使用它,如: #ifdef DEBUG #myVar @"aValue" #else #myVar @"anotherValue" #endif 只需将
#if TARGET1
#myVar @"aValue"
#elsif TARGET2
#myVar @"anotherValue"
#endif
提前谢谢你 有关特定目标和“预处理器宏”选项,请参见xcode项目中的“生成设置”选项卡。您可以在此处定义宏并在代码中使用它,如:
#ifdef DEBUG
#myVar @"aValue"
#else
#myVar @"anotherValue"
#endif
只需将
TARGET1=1
添加到TARGET1预处理器宏中
,对于target2,也应将其添加到target2=1
。如果