3

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.

Community
  • 1
  • 1
WildMassacre
  • 103
  • 2
  • 6

3 Answers3

2

Here is what I tried -

  • Firebase was giving me an issue so I deleted it from my podfile and removed it from the project by doing pod install
  • Then I added it back and pod installed again
  • I finally cleared my derived data the same way you did

This managed to get my project running once again

2

Solution For Different Cases

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.

enter image description here

Swift Package Manager

  • If you have Swift Package Manager in your project, you've to Reset Package Caches after the cleaning (Derived Data Directory). That operation will re-load the whole packages in your project.

Other Cases

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.

MGY
  • 7,245
  • 5
  • 41
  • 74
  • 1
    This error appears again and again after switching from one git branch to another. Cleaning derived data solves issue one time. Looking for permanent solution. – andrey Jun 01 '21 at 14:05
  • I encountered this issue along with Flutter build flavor changing. I struggled a lot googling and trying out many other solutions since Flutter or Xcode is not telling this right the first time where to look and what to do. However by clearing up the whole DerivedData directory as a whole (because I don't know any of the sub folders inter-dependencies, and whenver we build an iOS app or run it, these DerivedData are generated as per the needs), only then it worked. Thanks for bringing this up! – Randika Vishman Aug 12 '22 at 17:07
0

In my case I just deleted the build folder and ran the app again

Madhav Tripathi
  • 159
  • 1
  • 2
  • 7