Xcode 4 code sense is not working

后端 未结 13 1310
臣服心动
臣服心动 2020-11-30 19:38

I am running a \"old\" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:

  • Clean/rebuild
  • Remove Der
相关标签:
13条回答
  • 2020-11-30 19:54

    Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.

    I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.

    BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.

    0 讨论(0)
  • 2020-11-30 19:54

    FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.

    0 讨论(0)
  • 2020-11-30 19:54

    Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.

    Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.

    I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...

    0 讨论(0)
  • 2020-11-30 19:55

    From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running

    defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3

    in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.

    0 讨论(0)
  • 2020-11-30 20:03

    I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/

    • Close the project, leaving XCode still running.

    • Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.

    • Quit XCode.

    • Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”

    • Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.

    • Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”

    • When your CPU spike returns to earth, code completion will be working again.

    There's a lot of deleting going on there so please be careful, but this definitely worked for me.

    0 讨论(0)
  • 2020-11-30 20:06

    I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.

    Running Xcode 4.3.1 on Lion

    Hope this helps someone.

    0 讨论(0)
提交回复
热议问题