So, I don't know how but one day I've start getting this type or errors: (sometimes two errors)
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVMetalTextureCache.h:30:2: Malformed or corrupted AST file: 'Unable to load module "/Users/WildMassacre/Library/Developer/Xcode/DerivedData/ModuleCache/1CGHHHX14XIR3/Foundation-1LVW63VL3OCXN.pcm": signature mismatch'
(By the way what is "signature mismatch?". Sometimes it's "file out of date" and another type of error which I can't remember at this moment).
And a lot of (sometimes only one or two errors. different modules. sometimes it is Foundation / UIKit / Metal / CoreVideo / etc):
/Users/WildMassacre/Documents/Developing/iOS/Provocante/Store/SizeCell.h:9:9: Could not build module 'UIKit'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:10:9: Could not build module 'CoreImage'
and etc.
First of all, yes, I've tried to delete derived data and clean (or deep clean) project – nothing works. And as someone told me I've tried to change DerivedData folder to relative instead of default — same errors.
I'm so confused because I submitted my app to the AppStore before (for TestFlight actually), but now — I got this errors. (and i don't remember that i change something global) Sometimes (sic!) it can build successfully and then when I try to archive — error. And sometimes it can't build at all. Sometimes (just randomly as i can see) it can build and run on simulator/real device. And again there was no time I can archive this (i mean when I start getting this error, not when I upload my app to the AppStore).
As you can notice I used a word "sometimes" a lot. Well, because I really don't know why I'm still getting this errors in a different forms(?) and different modules randomly. (for example, it worked twice at least: build (errors) -> change in Build Settings use C and Objective-C modules to NO -> build (errors) -> change back to YES -> build (no errors)) Or it can build and run on simulator but can't on real device/"ios device"..
My flags in Build Settings: (for MailCore 2.0 and some other libs)
-lctemplate-ios
-lxml2
-letpan-ios
-lsasl2
-liconv
-ltidy
-lz
-lc++
-lresolv
-stdlib=libc++
-ObjC
I really don't know what to do: I've searched a lot, saw a lot of questions here, on stackoverflow, but nothing works.
By the way, I have changed my project name and then scheme and etc.. I thought that I can do something wrong while doing that. But when I open my reserve project with no project name changes – same errors.
Maybe I should delete and clean project another way? Or change something in projects scheme (not only the name("old"->"new") as I did)? Reinstall Xcode? Or maybe you can tell me what can i changed in my project to start getting this error, because I don't remember that I change something (since project version that i uploaded to the app store) except ~200 code lines.
Please tell me if I have to provide you more information about the project.
I hope you can help me to solve this issue! Thanks!
______________________________________________________________
Added:
The problem is Optimization! (i think). When I tried to archive (change in scheme) as debug (not release) — its ok and I can archive it without optimization.
Then I tried to set any type of optimization (in Build Settings — Apple LLVM 6.1 Code-Generation — Optimization Level) for example: Fastest/Smallest or Fast. And any option except "None" (no optimization) will throw an error. But! When I set optimization level to None in release build and then try to archive as release — still error. Maybe optimization doesnt matter now? I'so confused! This is really magic happening to this project.
Why?
______________________________________________________________
Added: And know it can archive as debug but with -O3 optimization... So, maybe something wrong in my release settings? Can you give me a tips?
Thanks for read all of this.
Here is what I tried -
This managed to get my project running once again
Obviously, the original post says "...yes, I've tried to delete derived data and clean...". I totally understand that.
This answer for the others who face this error after Xcode Version - 12.5.
In my case, starting with the Xcode Version - 12.5 (12E262) I'm facing the same errors. But, cleaning the Derived Data was the only solution.

Remember that, this error can show itself in so many different ways. Please comment under this answer if you have faced this error another way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With