How to fix PCH error?

Go to Xcode Preferences->Locations (as mentioned in the answer by wcochran) and simply rename your DerivedData folder. I simply changed mine from "DerivedData" to "DerivedData2" and that forced the system to stop referencing the old location. This fixed it for me when none of the other answers worked. See pic:

enter image description here


Delete the DerivedData folder for the project. Look under Xcode preferences -> Locations to see where you save it.


This is often a caching problem. Usually it can be resolved by holding down the Option key and choosing Product > Clean Build Folder...


It seems that the Product > Clean Build Folder... (with Option key pressed) works for most people. See the selected answer by @gaige.

If you're unlike most people (myself included) and this still causes you trouble XCode has likely left your shared precompiled headers elsewhere. For me they were in a folder similar to this:

/var/folders/<some random two characters>/<some random string>/C/com.apple.Xcode.502/SharedPrecompiledHeaders

I just deleted the entire SharedPrecompiledHeaders folder and that solved things for me. I wouldn't go touching much else in here though...