Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用预处理器宏测试选定目标_Ios_Xcode_Macros_Preprocessor - Fatal编程技术网

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
。如果