xcode 致命错误:自预编译头文件以来,文件已被修改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22034531/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:42:07  来源:igfitidea点击:

fatal error: file has been modified since the precompiled header

iosxcode

提问by Rajesh

Checked all of the question shown in image but nothing works out. enter image description here

检查了图像中显示的所有问题,但没有任何效果。 在此处输入图片说明

In xcode 5 I m getting this issue

在 xcode 5 中,我遇到了这个问题

fatal error: file '/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h' has been modified since the precompiled header '/Users/administrator/Library/Developer/Xcode/DerivedData/ModuleCache/220IXKWL5NEDF/UIKit.pcm' was built note: after modifying system headers, please delete the module cache at '/Users/administrator/Library/Developer/Xcode/DerivedData/ModuleCache/220IXKWL5NEDF' 1 error generated.

致命错误:文件“/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h”有由于预编译头文件'/Users/administrator/Library/Developer/Xcode/DerivedData/ModuleCache/220IXKWL5NEDF/UIKit.pcm'被修改注意:修改系统头文件后,请删除'/Users/administrator/Library的模块缓存/Developer/Xcode/DerivedData/ModuleCache/220IXKWL5NEDF' 1 错误生成。

What could be the issue??? Any help ld be greatly appreciated.

可能是什么问题???任何帮助都将不胜感激。

回答by ChandreshKanetiya

  1. Delete DerivedData at /Library/Developer/Xcode/DerivedData/
  2. Reset your simulator
  1. 删除 /Library/Developer/Xcode/DerivedData/ 中的 DerivedData
  2. 重置模拟器

Quit xcode and then it runs again.

退出 xcode,然后再次运行。

回答by KepPM

Deep clean (Cmd + Opt + Shft + K), clearing folder DerivedData, clearing simulator, restarting Xcode and mac doesn't work for me.

深度清理(Cmd + Opt + Shft + K)、清除文件夹 DerivedData、清除模拟器、重新启动 Xcode 和 mac 对我不起作用。

Problem was fixed only after changing pch-file (adding a whitespace or comment/uncomment some code). File was incorrectly cached on build phase by Xcode. Changing this file fixed problem.

仅在更改 pch-file(添加空格或注释/取消注释某些代码)后才修复问题。Xcode 在构建阶段错误地缓存了文件。更改此文件修复了问题。

回答by deepax11

It is a very common problem if you are dealing with library development.I would suggest you to set Precompile Prefix Headerto NO. Nothing worked for me except this.

如果您正在处理库开发,这是一个非常常见的问题。我建议您设置Precompile Prefix HeaderNO. 除了这个,没有什么对我有用。

回答by Beau Nouvelle

If the other mentioned solutions don't work for you, here's what works for me.

如果其他提到的解决方案对您不起作用,那么这对我有用。

  1. Go to the folder that contains the mentioned simulator in the error message. In my case it was: Xcode > Contents > Developer > Platforms > iPhoneSimulator.platform > Developer > SDKs Then delete the simulator/s in that folder.

  2. Go to Xcodes preferences > downloads > and hit "check and install" to get your simulators back.

  3. Do a clean, and delete derived data.

  1. 转到包含错误消息中提到的模拟器的文件夹。就我而言,它是:Xcode > Contents > Developer > Platforms > iPhoneSimulator.platform > Developer > SDKs 然后删除该文件夹中的模拟器。

  2. 转到 Xcodes 首选项 > 下载 > 并点击“检查并安装”以恢复您的模拟器。

  3. 做一个清理,并删除派生数据。

I found that this error occurs mostly when I'm working in interface builder and have the assistant editor set to automatic. Sometimes the auto file will be something like NSObject, and if you accidentally edit that, you will get this error.

我发现这个错误主要发生在我在界面构建器中工作并将助理编辑器设置为自动时。有时自动文件将类似于 NSObject,如果您不小心编辑了它,您将收到此错误。

Alternatively, if you have time machine set up, you can restore the offending file.

或者,如果您设置了时间机器,则可以恢复有问题的文件。

回答by Chathura Palihakkara

If above not worked try delete precompiled header folders in /var/folders/d4/pz....00gq/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/your appchange the path according to your machine and find the precompiled header folders then delete and run again.

如果以上不起作用,请尝试删除预编译头文件夹,/var/folders/d4/pz....00gq/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/your app根据您的机器更改路径并找到预编译头文件夹,然后删除并再次运行。