Malformed or corrupted AST file

2019-03-08 03:08发布

I have a problem I don't know why did it happen in the first place but most probably because I've pressed move to trash to some system frameworks by mistake.

I got an error that says:

malformed or corrupted AST file: 'could not find file '/Users/username/myProject/QuartzCore.framework/Headers/CAMediaTiming.h' referenced by AST file'

I've tried to copy QuartzCore.framework in that Directory. It give me then a punch of new errors. Then if I remove the framework from the Dir. Everything will be good for the project till I make any code change. Then I would have to make the previous scenario again. It's very annoying now and I really need to fix this. Anyone?

7条回答
男人必须洒脱
2楼-- · 2019-03-08 03:57

Hi all I got the same error because I have opened two projects at a time and drag and dropped frameworks from one project to another . After some time I realised that this is not a right way. I moved all frameworks which are dragged from another project to trash. Then clean and run in simulator everything is working fine.

Delete frameworks->again add frameworks->clean and run

I hope it will help someone

查看更多
可以哭但决不认输i
3楼-- · 2019-03-08 04:00

As requested:

What caused this error for me (after getting the new Xcode) was I would try to run a project in simulator (accidentally in simulator, I never use simulator), but I'd forget to select my device or my device would become unplugged without me noticing, and it will try to run in simulator... so I would get those classic ".o" file errors... Then I would switch back to my device and get corrupt AST files...


To CURE the problem... (Follow the steps below VERY closely!!!!!)

  1. Clean your project
  2. QUIT Xcode (CMD+Q)
  3. Run this Terminal Command:
    rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
  4. Reopen Xcode
  5. MAKE SURE YOU HAVE YOUR DEVICE SELECTED AND NOT SIMULATOR
  6. CLEAN project (Yes, again)
  7. THEN build (to your device, not to simulator)...

Enjoy!

Note: After further experimentation I've found that the force-quitting of xCode is possibly not necessary.

查看更多
Luminary・发光体
4楼-- · 2019-03-08 04:07

I just clean my project and re-build. Everything back to normal.

查看更多
Rolldiameter
5楼-- · 2019-03-08 04:11

In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.

Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.

...And now I can build again. Hooray! From terminal:

[sudo] rm -rf /var/folders/*

(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)

Additional clue: I could build with XCode-6-beta, but got the goofy "corrupted AST file" error in XCode-5.

查看更多
家丑人穷心不美
6楼-- · 2019-03-08 04:12

In my situation, all I needed to do was click Product > Clean, then build the project again. It succeeded. Hope this helps some others who run into the same situation.

查看更多
劫难
7楼-- · 2019-03-08 04:12

Personnaly, just one solution worked for me: In Xcode Go to Window -> Organizer Clic on the "delete" button near the "derived data" directory. Then Run again your project...

查看更多
登录 后发表回答