代码在Xcode 4中失去语法颜色 [英] Code loses syntax color in Xcode 4

查看:96
本文介绍了代码在Xcode 4中失去语法颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到新的 Xcode 4 ,并且该代码没有着色.

I have just upgraded to the new Xcode 4 and the code is not colored has it ought to be.

例如,字符串NSString在我的自定义代码中没有着色,但是当我切换到Apple的代码(例如,NSString.h)时,所有内容都着色良好.

For instance, the string NSString is not colored in my custom code, but when I switch to Apple's code (NSString.h for example) everything is well colored.

我该如何解决?

推荐答案

这是最新XCode的已知错误.从XCode 3.X迁移到新版本的某些项目会发生这种情况.对于某些人来说,去组织者似乎有所帮助,并在项目"选项卡中删除代码感知无法正常工作的项目的派生数据.

It's a known bug with the latest XCode. This happens with some projects which are migrated from XCode 3.X to the new version. For some people it seems to help to go to the organizer, and in the project tab delete the derived data for the project where code sense does not work correctly.

如果您有一个小型项目,则可能还会有助于在XCode 4中创建一个新项目并从XCode 3项目中导入文件.

If you have a small project, it might also help to create a new project in XCode 4 and import the files from the XCode 3 project.

更新:XCode 4.0.1使情况变得更好了,至少在我的某些项目中,我有了语法着色和代码感知功能.但这还远未解决.

Update: XCode 4.0.1 made the situation a bit better, at least in some of my projects I have syntax coloring and code sense back. But it's still far from fixed.

更新2: XCode 4.0.2的更改不大.看来问题出在子项目上,尤其是静态库上.根据此博客帖子的评论,一些人通过改变相对于绝对路径的标头搜索路径,例如代替Foo/Bar使用$(SOURCE_ROOT)/Foo/Bar.这与将所有项目切换到XCode 3.1格式以及使用LLVM 2.0一起对我来说也很固定.尚不完美,但可以使用.

Update 2: XCode 4.0.2 did not change much. It seems that the problem is related to subprojects, specifically static libraries. According to comments of this blog post some people were successful by changing header search paths from relative to absolute paths, e.g. instead of Foo/Bar use $(SOURCE_ROOT)/Foo/Bar. This together with switching all projects to XCode 3.1 format and to use LLVM 2.0 fixed a lot for me as well. It's not perfect yet, but usable.

更新3::将子项目转换为独立项目并将其放入

Update 3: After converting the sub projects to independent projects and putting them in a workspace (aka the XCode 4 way) I have now full syntax highlighting and code completion back.

我当前的环境是一个XCode 4工作区,每个项目都兼容3.1(与默认值3.2相对),LLVM GCC 4.2(系统默认值)和标头搜索路径仍然是绝对的(使用$(SOURCE_ROOT)/.../)

My current environment is now a XCode 4 workspace with each projects being 3.1 compatible (as opposed to the default which is 3.2), LLVM GCC 4.2 (system default) and the header search paths are still absolute (using $(SOURCE_ROOT)/.../).

这篇关于代码在Xcode 4中失去语法颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆