开发者

Xcode 4 code loses syntax coloring when importing project from Xcode 3

开发者 https://www.devze.com 2023-02-18 17:13 出处:网络
I have just upgraded to the new Xcode 4 and the code is not colored has it should be. I am trying to use a project that I created on Xcode 3.

I have just upgraded to the new Xcode 4 and the code is not colored has it should be. I am trying to use a project that I created on Xcode 3.

For instance, the string 'NSString' is not colored开发者_如何学JAVA in my custom code, but when I switch to Apple's code (NSString.h for ex.) everything is well colored.

How can I fix that?

Thanks a lot, Martin


Open the Organizer (Window > Organizer) and select the Projects mode. Select your project in the left-hand view and then click the Delete… button for the project's Derived Data.

This will delete the code sense index for the project and force Xcode to rebuild the index, which should fix the problem.


I got it to work by prefixing all my project search paths with "$(SOURCE_ROOT)/" instead of just using a project relative path. Eg "Include" becomes "$(SOURCE_ROOT)/Include".

Do this and then force a rebuild of the index by deleting the projects derived data from the organizer.


After trying most, if not all, of the steps above, I have succeeded in restoring my colorful Xcode eye candy by finding and deleting (in Finder) all of the derived data created from my project (there were several folders for my project that were lingering even after deletion from the Window > Organizer menu).

My project's folders that needed deletion were located in ~Library/Developer/Xcode/DerivedData


Also try this, select all(command + A) from your Prefix.pch file -> cut it(command + X) -> Build(command + B)(don't worry for error) -> paste(whatever you copy from Prefic.pch file in that file only)(commmand + V) -> Build again (command + B).


Try Product -> Clean and then Product -> Build


Remove the files from your project (just remove, don't delete them!) and re-import them.


Its possible that the permissions on the folder where Xcode stores the code-sense cache is broken. If the cache cannot be correctly written or read when you launch Xcode, it will behave as you describe.

Try locating the folder (you can locate it in the organizer. Hit the arrow next to the path.) and reset its permissions in the Get Info dialog.


There is another cause for this issue, it had been happening to me with beta versions of Xcode, you need to check that the .m file is added to the target in order to make it add color to the classes and enable the autocompletion.

You can check it out in the Xcode inspector

Xcode 4 code loses syntax coloring when importing project from Xcode 3

Hope this helps,

best regards,

Jorge.

0

精彩评论

暂无评论...
验证码 换一张
取 消