fatal error: malformed or corrupted AST file - Xcode

IosXcodeIos7

Ios Problem Overview


I get this error when building my app in the latest version of Xcode:

> fatal error: malformed or corrupted AST file: 'Unable to load module > "/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm": > file not found' note: after modifying system headers, please delete > the module cache at > '/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP' > 1 error generated.

When I navigate to:

> /Users/me/Library/Developer/Xcode/DerivedData/ModuleCache

I can see that the directory 'XYZYIE6ZV0OP' doesn't exist.

Does anybody know how I can resolve this? I cannot delete anything at the directory as suggested in the 2nd part of the error message as that directory doesn't exist!

Ios Solutions


Solution 1 - Ios

Had same problem. Clearing derived data folder solved the issue for me. In Xcode, go to Window->Organizer->Projects, select your project, and press the "Delete..." button next to "Derived data".

If this doesn't work, you can try to do a Product->Clean (Cmd+Shift+k).

Solution 2 - Ios

Press Command + shift + k or clean the project and then run project...

Solution 3 - Ios

In Xcode select Product-->Clean problem will be solved

Solution 4 - Ios

By default Library folder is hidden in Mac. Best way to navigate to that folder is :

  1. Open Finder
  2. Select Go from menu -> Select "Go to folder"
  3. Type : /Users/"your user name"/Library/Developer/xcode

This will open direct xcode folder inside hidden library folder.

  1. Select "DerivedData" folder
  2. Command + A, select all and delete them.
  3. Open Simulator and "Reset Content and Settings".

Now run XCode again, all will fix.

Solution 5 - Ios

I had the same issue, solved it by cleaning the project.

Product-> Clean

or press

command+shift+K

Solution 6 - Ios

In my case, I accidentally modified NSURLConnection.h. Xcode complained about cache at path

> /var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/5.0.2-5A3005/Xcode/ModuleCache/XWWWZ5ED888F

I finally found the steps to fix it:

  1. Quit Xcode
  2. Delete the upper "5.0.2-5A3005" at /var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005

When Xcode restarted, it regenerated that folder and everything in it.

Solution 7 - Ios

I had the same issue ever since installing the latest SDK.

My solution was to delete the derived data and clean the project.

Solution 8 - Ios

I got same error on executing xcodebuild command of Xcode6-beta5.app coexisting with Xcode.app (Xcode 5).

In this case I added -derivedDataPath to separate ModuleCache from the one for default Xcode.app.

  xcodebuild -derivedDataPath ./build/Xcode6-beta5/DerivedData ....

This works for me.

Solution 9 - Ios

I tried deleting derived data and Clean project several times and it doesn't work. The file in my warning is an old file I already deleted from Project Navigator and all the Build Settings. But it keeps showing up and gives me this error. The error only occurs on Simulator, but not on device. Which is really really weird. :/

For some reason, I switched branch to some other branch and switch back and it works again. If anyone even know how that could work please tell me :D

Solution 10 - Ios

Simply clean remove the Derived Data and build folders. The problem shall be resolved.

Solution 11 - Ios

In my case the SSD was broken. You can verify the disk with apples Disk Utility

Solution 12 - Ios

In my case I had a spaces in my plist file name.

I removed it, and changed Info.plist File key in target Build Settings

Solution 13 - Ios

Refreash Safari browser, scroll down the page and you will see you "Click + button for add build ..." then add actual build, click Save and "Waiting for Review"

Solution 14 - Ios

Cleaning the project and deleting the drive data didn't fix it for me. But what finally fixed it was changing the model of simulator that I used.

So first do a clean, then if you were running it on iPhone 5 simulator, run it on iPhone 5s simulator to fix the issue. basically, run it on any other simulator other than the one you were running.

(Credit to Hlung for his answer, I hope this one is a bit more clear)

Solution 15 - Ios

If you have your project scheme set to "Wait for executable to be launched" this error might happen.

In that case, just changed your scheme from Product > Scheme > Edit Scheme...

Solution 16 - Ios

In my case, I tried to archive a app in one project within a xcodeworkspace

close Xcode, the open the single target project, and clean an Then, I do archive, it makes an iOS App archive.

I hope I can help someone.

Solution 17 - Ios

Got this error while trying to build a third-party app for the first time. Adding foundation as a library fixed the issue for me.

Solution 18 - Ios

I did Clean cached, Delete derived data, Manually delete the Module cache folders which found from the error logs, Restart xcode, Restart machine. But non of them helped me.

But this steps help me to resolve the issues

  • Comment out all the #import line in [Name]-Prefix.pch files.
  • Build, as expected its pointing me to different errors.
  • Revert back the changes I have done in [Name]-Prefix.pch and Build, compilation succeeded.

This solution help me to resolve the issue.

Solution 19 - Ios

if you can't find your "Derived data"

  1. File -> Workspace settings
  2. Click on the arrow icon next to your path
  3. Remove "Derived data" folder

Solution 20 - Ios

tried to re-install XCode which didnt resolve the issue, also created a new local user account & get the same error so in the end I gave up & restored to a time machine backup from a few days before... seems to be ok again... for now!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser2820855View Question on Stackoverflow
Solution 1 - IosdevgeekView Answer on Stackoverflow
Solution 2 - IosNitesh BoradView Answer on Stackoverflow
Solution 3 - IosSubathra DView Answer on Stackoverflow
Solution 4 - IosMuzammilView Answer on Stackoverflow
Solution 5 - IosAhsan EbrahimView Answer on Stackoverflow
Solution 6 - IosWalt SellersView Answer on Stackoverflow
Solution 7 - IosMakView Answer on Stackoverflow
Solution 8 - IoshiroshiView Answer on Stackoverflow
Solution 9 - IosHlungView Answer on Stackoverflow
Solution 10 - IosDevashis KantView Answer on Stackoverflow
Solution 11 - IosPascaliusView Answer on Stackoverflow
Solution 12 - IosTobiaszParysView Answer on Stackoverflow
Solution 13 - IosdmuchowskiView Answer on Stackoverflow
Solution 14 - IosStan TatarnykovView Answer on Stackoverflow
Solution 15 - IosykondaView Answer on Stackoverflow
Solution 16 - Iosuser9527View Answer on Stackoverflow
Solution 17 - IosOnichanView Answer on Stackoverflow
Solution 18 - IosdamithHView Answer on Stackoverflow
Solution 19 - IosCyrus ZeiView Answer on Stackoverflow
Solution 20 - Iosuser2820855View Answer on Stackoverflow