Reputation: 10203
This problem is very similar to this one: Xcode 4 Preview 4 displays "Build Succeeded" but with errors
The different solutions proposed at the link doesn't work. I tried using product clean, deleteing the Derived Data, restart XCode and the Mac, but the problem still appears.
It seems that all the error are linked to the project's precompiled header : although the PCH is working fine and has no error in itself, the errors reported look like the pch is not found for this specific file. Also sometimes, while the build progresses, the errors appear and disappear randomly. Anyone have an idea on this?
The error only appear in the file(s) opened in the editor. If I close the file's in xcode but keep the project open, then no error are reported at all.
Upvotes: 30
Views: 6345
Reputation: 364
Removing the last #import from .pch file, build the app then putting it back and building it again did the trick for me.
If you still see the errors then you could repeat this step for last two imports, last three imports and so on.
Upvotes: 0
Reputation: 37
Go to xcode install folder like below.
/Users/vinod/Library/Developer/Xcode
Step-1 Quit the xcode
Step-2 Delete the DerivedData Folder
Step-3 Now open the project and clean it all issue resolved.
Upvotes: 1
Reputation: 1771
to add my two cents: my solution was to slightly change the order of imports in the pch file.
Maybe this is related to simply edit the file, but I've tried to "touch" it and edit and the only "thing" that did fix the problem was to move some import before others.
Upvotes: 0
Reputation: 9012
Have you tried cleaning the build folder?
In XCode, open the Product menu then hold down option. Clean should change to Clean Build Folder.
Edit:
You can also press ⌘ + ⌥ + ⇧ + K
Upvotes: 27
Reputation: 5347
Cleaning the product folder and restarting didn't help me. I started seeing this after I deleted the DerivedData folder. I was able to "fix" by doing :
Upvotes: 2
Reputation: 4971
Cleaning, closing, restarting - none worked for me.
A simple touch/edit to the pch file in question resolved the issue.
Upvotes: 68
Reputation: 1977
I had this same issue, and neither types of cleans helped. I also tried deleting the build folder, restarting xcode, etc and for me what finally solved the issue was to remove the files that the errors referenced and re-add them.
Additionally, I investigated the error after the fact, and the issue seems to be XCode's "Show Live Issues" feature. (This can be unchecked in the preferences, this also solved the issue but was unsatisfactory as a solution as I've grown to enjoy xcode's live code sense.)
Upvotes: 5
Reputation: 14154
I'm not sure adding a define to the pch will work as you think. Try creating a Constants header and add your defines there. Then you can include the import statement in your pch file and it should work that way.
Upvotes: 1