Xcode code sense and cmd+click to symbol doesn'

2019-01-16 16:30发布

问题:

I've been using Xcode 4.3.1 since it came out now and i've worked on many different projects since. Everything has always worked fine until this 1 new project i'm working on.

The code completion/code sense never finds anything or when i 'Command+Click' a variable or class normally it would jump to that but now i'm just getting 'Symbol Not Found'.

If I open one of my older project while this bad one is open, the old ones still work for code sense and the new one doesn't.

My partner is working on the same project, we both get the files from our repository and the code sense works on his machine for this project...just not mine.

So i'm a little confused as to how to fix this..any ideas?!

Thanks!

回答1:

Try this:

Open the organizer. Close your project in Xcode (leaving Xcode and the organizer running). In the organizer, in projects, click on the Delete button next to Derived Data. Quit Xcode.

Find your Xcode project via the finder. Rightclick and "Show Package Contents". Delete project.xcworkspace and xcuserdata folder.

Open up Xcode again and see if that works for you.



回答2:

With Xcode 8.2 I solved in this way:

  1. File > Workspace Settings
  2. Click over the little grey arrow above Advanced... Button (Derived Data)
  3. Select my project folder and delete it.

Now in your project see if cmd+click works



回答3:

In my case I solved in this way.

  • Go to Project's propreties from Project navigator.
  • Build Phases
  • Add your *.m files in "Compile Sources"

Now re-build.

This could be happen, for instance, when your manually rename a class after its creations.

Hope this help.



回答4:

Similar issues with XCode 8. Just quitting the XCode and Simulator, reopening the project worked. Other times, Restarting the mac gets rid of question mark and does navigate to relevant method implementations

And at times, simply closing the project and opening it again from 'File -> Open Recent' also works (XCode 8 and Swift 3)



回答5:

In my case, .m file was somehow located in en.lproj directory and that prevented it from being shown properly with syntax coloring and intellisense on.

In the File inspector side panel check if there is something checked in Localization tab.



回答6:

I had this problem, restarted, quit Xcode, nothing happened. Switched to master branch, pulled, checkout into new branch. Problem Gone. I even went back to my previous branch and all was working. My only guess is that git messes up sometimes!



回答7:

For others if none of the above mentioned methods worked try this :

Go to menu bar Xcode - > Preferences -> Locations -> Command Line Tools

Choose proper (current) Xcode format here.



回答8:

3 reasons this happens :

  1. Corrupt derived data : Solution : clean derived data folder.

  2. Corrupt project settings : Project.xcodeproject -> Right Click and clean the files mentioned in g_low's answer.

  3. File not a part of project target : Check if the file is a part of compile source and if not add it...