Xcode shows many errors but program compiles and runs fine (in both simulator and device)

I finally solved this after MANY attempts using the following:

Remove the last #import from my Prefix.pch and build again. Errors would happen (obviously). Put the line back and build again. No errors would show and after 10 seconds or so, errors would come back again.

Repeat the above except instead of the last #import, remove the last TWO imports, then three, four, etc. I did this until I removed five imports and when I put them back and waited, Xcode stopped complaining.

Note that this didn't occur to me at all. I read this solution on a blog somewhere.

Weird bug...


Open build settings and set "Precompile Prefix Header" to "No", that solved my problem.

Kudos for: https://stackoverflow.com/a/7035492/936957


I've been running into these issues constantly on all the latest versions of Xcode, in both Objective-C and Swift.

I noticed today that I was getting the errors in one particular class file. I removed it from some extra targets it was in and the errors finally went away!

I think Xcode has some fundamental bugs with it's handling of multiple targets right now. My theory is that if the other target is not built, you will essentially see errors from that target. Anyway hope this helps someone.