Question:
When I try to build my app in Xcode, I get this error message:
PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))
Answer:
This is often a caching problem. Usually it can be resolved by holding down the Option key and choosing Product > Clean
There is a Product > Clean, but it does a less thorough job. Some people can get buy with Product > Clean, for most Product > Clean Build Folder... is sufficient, and others need the manual removal as indicated in
之前有在代码全部正确的情况下,遇到过下面的编译错误:
fatal error: file ‘.....h‘ has been modified since the precompiled header ‘.....‘ was built.
note: please rebuld precompiled header ‘....‘.
解决方法是删除文件夹下/Users/username/Library/Developer/Xcode/DerivedData/ModuleCache下的所有文件,然后重新编译,一般就会好了.
但是偶尔在删除ModuleCache下文件之后,不仅没有解决上面的问题,还会报下面的错误:
fatal error: malformed or corrupted AST file: ‘Unable to load module "/Users/username/Library/Developer/Xcode/DerivedData/ModuleCache/GJQSWZVUR8F9/Foundation-PNFYWITLP4HB.pcm": module file not found‘
这个时候执行一下deep clean就可以了,具体的做法是按组合键“Option+Command+Shift+K”. 编译过程中的中间文件都会被删除,然后就可以通过编译了.