Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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
Objective c 为什么Xcode4不在条件编译块中进行语法高亮显示?_Objective C_Ios_Xcode_Xcode4_Conditional Compilation - Fatal编程技术网

Objective c 为什么Xcode4不在条件编译块中进行语法高亮显示?

Objective c 为什么Xcode4不在条件编译块中进行语法高亮显示?,objective-c,ios,xcode,xcode4,conditional-compilation,Objective C,Ios,Xcode,Xcode4,Conditional Compilation,例如: #ifdef FREE_VERSION tf.text = @"Free"; NSLog(@"FREE VERSION"); #else tf.text = @"Paid"; NSLog(@"PAID VERSION"); #endif 第一部分在Xcode中看起来很好 tf.text = @"Free"; NSLog(@"FREE VERSION"); 语法突出显示。但是,第二部分不是: tf.text=@“已支付” NSLog(“付

例如:

#ifdef FREE_VERSION
    tf.text = @"Free";
    NSLog(@"FREE VERSION");
#else
    tf.text = @"Paid";
    NSLog(@"PAID VERSION");
#endif
第一部分在Xcode中看起来很好

    tf.text = @"Free";
    NSLog(@"FREE VERSION");
语法突出显示。但是,第二部分不是:

tf.text=@“已支付”

NSLog(“付费版”)


是否有类似“在条件编译代码的#else部分中不进行语法突出显示”这样的设置?

XCode将尝试确定将采用哪个预处理器分支。预期执行的分支将有语法高亮显示,而另一个没有。

大多数IDE(包括XCode和Visual Studio)都不会高亮显示(未执行)条件块中的代码,因为在许多情况下,这将导致不应用的错误和高亮显示混乱。考虑一个用法,例如

#ifdef __APPLE__
// Do something that uses apple-only headers/functions
#endif
#ifdef _MSVC_VER
// Do something that visual studio recognizes
#endif
用于在多个平台上运行的代码。VisualStudio不知道如何突出显示Apple函数名,XCode也不知道如何处理VisualStudio的pragmas等