ios 致命错误:格式错误或损坏的 AST 文件 - Xcode
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20984166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fatal error: malformed or corrupted AST file - Xcode
提问by user2820855
I get this error when building my app in the latest version of Xcode:
在最新版本的 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.
致命错误:格式错误或损坏的 AST 文件:“无法加载模块“/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm”:找不到文件“注意:修改系统头文件后,请删除'/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP' 中的模块缓存生成了 1 个错误。
When I navigate to:
当我导航到:
/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache
/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache
I can see that the directory 'XYZYIE6ZV0OP' doesn't exist.
我可以看到目录“XYZYIE6ZV0OP”不存在。
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!
有谁知道我该如何解决这个问题?我无法按照错误消息第二部分的建议删除目录中的任何内容,因为该目录不存在!
回答by devgeek
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".
有同样的问题。清除派生数据文件夹为我解决了这个问题。在 Xcode 中,转到 Window->Organizer->Projects,选择您的项目,然后按“Derived data”旁边的“Delete...”按钮。
If this doesn't work, you can try to do a Product->Clean (Cmd
+Shift
+k
).
如果这不起作用,您可以尝试执行 Product->Clean ( Cmd
+ Shift
+ k
)。
回答by Nitesh Borad
Press Command + shift + k or clean the project and then run project...
按 Command + shift + k 或清理项目,然后运行项目...
回答by Subathra D
In Xcode select Product-->Clean problem will be solved
在 Xcode 中选择 Product-->Clean 问题就解决了
回答by Muzammil
By default Library folder is hidden in Mac. Best way to navigate to that folder is :
默认情况下,库文件夹在 Mac 中是隐藏的。导航到该文件夹的最佳方法是:
- Open Finder
- Select Go from menu -> Select "Go to folder"
- Type : /Users/"your user name"/Library/Developer/xcode
- 打开查找器
- 从菜单中选择 Go -> 选择“Go to folder”
- 输入:/Users/“你的用户名”/Library/Developer/xcode
This will open direct xcode folder inside hidden library folder.
这将打开隐藏库文件夹中的直接 xcode 文件夹。
- Select "DerivedData" folder
- Command + A, select all and delete them.
- Open Simulator and "Reset Content and Settings".
- 选择“DerivedData”文件夹
- Command + A,全选并删除它们。
- 打开模拟器和“重置内容和设置”。
Now run XCode again, all will fix.
现在再次运行 XCode,一切都会解决。
回答by Ahsan Ebrahim
I had the same issue, solved it by cleaning the project.
我有同样的问题,通过清理项目解决了它。
Product-> Clean
Product-> Clean
or press
或按
command+shift+K
command+shift+K
回答by Walt Sellers
In my case, I accidentally modified NSURLConnection.h. Xcode complained about cache at path
就我而言,我不小心修改了 NSURLConnection.h。Xcode 抱怨路径缓存
/var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/5.0.2-5A3005/Xcode/ModuleCache/XWWWZ5ED888F
/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:
我终于找到了修复它的步骤:
- Quit Xcode
- Delete the upper "5.0.2-5A3005" at /var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005
- 退出 Xcode
- 删除 /var/folders/p6/fk2rmf017sn2d_gds6dtqr6hrst8b2/C/com.apple.DeveloperTools/5.0.2-5A3005 上的“5.0.2-5A3005”
When Xcode restarted, it regenerated that folder and everything in it.
当 Xcode 重新启动时,它会重新生成该文件夹及其中的所有内容。
回答by Mak
I had the same issue ever since installing the latest SDK.
自从安装最新的 SDK 以来,我遇到了同样的问题。
My solution was to delete the derived data and clean the project.
我的解决方案是删除派生数据并清理项目。
回答by hiroshi
I got same error on executing xcodebuild command of Xcode6-beta5.app coexisting with Xcode.app (Xcode 5).
我在执行与 Xcode.app (Xcode 5) 共存的 Xcode6-beta5.app 的 xcodebuild 命令时遇到了同样的错误。
In this case I added -derivedDataPath
to separate ModuleCache from the one for default Xcode.app.
在这种情况下,我添加-derivedDataPath
了将 ModuleCache 与默认 Xcode.app 分开的模块。
xcodebuild -derivedDataPath ./build/Xcode6-beta5/DerivedData ....
This works for me.
这对我有用。
回答by Hlung
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 backand it works again. If anyone even know how that could work please tell me :D
出于某种原因,我将分支切换到其他分支并切换回来,它再次工作。如果有人知道那是如何工作的,请告诉我:D
回答by Devashis Kant
Simply clean remove the Derived Data and build folders. The problem shall be resolved.
只需清理删除派生数据并构建文件夹。问题将得到解决。