修复文件“project.pch”已被修改,因为预编译头文件在 Xcode 中构建错误

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

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

xcodeinfo.plistpch

提问by user1542348

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:

我最近在 info.plist 部分处理我的应用程序,因为我的应用程序不会在我的测试设备上运行:

file 'project.pch' has been modified since the precompiled header was built

自构建预编译头以来,文件“project.pch”已被修改

Something to note is that the app runs fine in the simulator.

需要注意的是,该应用程序在模拟器中运行良好。



Edit: Now I am getting this error instead of the other one:

编辑:现在我收到这个错误而不是另一个错误:

No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)

没有这样的文件或目录(/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)

No such file or directory error

没有这样的文件或目录错误

How to regenerate the info.plist file?

如何重新生成 info.plist 文件?

回答by HexAndBugs

You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K

您可以尝试深度清洁(与产品 > 清洁不同)- Option+ Command+ Shift+K

Note:this means the clean the build folder(by pressing Option+ Product -> clean folder)

注意:这意味着清理构建文件夹(按Option+ Product -> clean folder)

回答by emotality

  1. Close your project or workspace.
  2. In Finder: ?shift+?cmd+G
  3. Paste: ~/Library/Developer/Xcode/DerivedData/
  4. Delete the ModuleCachefolder and empty trash.
  5. Open up your project.
  6. Clean: ?shift+?cmd+K
  7. Build: ?cmd+B
  1. 关闭您的项目或工作区。
  2. 在 Finder 中:?shift+ ?cmd+G
  3. 粘贴: ~/Library/Developer/Xcode/DerivedData/
  4. 删除ModuleCache文件夹并清空垃圾箱。
  5. 打开你的项目。
  6. 清洁:?shift+ ?cmd+K
  7. 构建:?cmd+B

回答by CedricSoubrie

In my case the error message had a small hint:

在我的情况下,错误消息有一个小提示:

note: after modifying system headers, please delete the module cache at '~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'

注意:修改系统头文件后,请删除'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'的模块缓存

I tried and it worked.

我试过了,它奏效了。

回答by ??u??

Simply touching the project's pch file solved this issue it for me :

只需触摸项目的 pch 文件即可为我解决此问题:

touch Test.pch

回答by Jorge SV

  • Product -> Clean
  • Product + Option-> Clean Build Folder
  • Close Project or Workspace
  • Clean 'ModuleCache' path in Finder.
  • 产品 -> 清洁
  • 产品 + Option-> 清理构建文件夹
  • 关闭项目或工作区
  • 清理 Finder 中的“ModuleCache”路径。

Worked for me in Xcode6 GM and iOS 8.0.

在 Xcode6 GM 和 iOS 8.0 中对我来说有效。

回答by Abhilash Gopal

When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.

当随 Xcode 提供的库的 .h 文件发生更改(甚至是空格)时,可能会发生此错误。

The following maybe tried in order to fix this issue

为了解决这个问题,可能会尝试以下方法

  • In, Project -> Build Settings, change Precompile Prefix Headerto NO

    OR

  • Run rm -rf ~/Library/Developer/Xcode/DerivedDataand Clean Build
  • Project -> Build Settings 中,将Precompile Prefix Header更改为NO

    或者

  • 运行rm -rf ~/Library/Developer/Xcode/DerivedDataClean Build

回答by kakyo

I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).

自从使用命令行构建 (xcodebuild) 时,使用 iOS 项目从 Xcode 4.6 升级到 Xcode 5 以来,我经常遇到这种情况。

What worked for me is to use this as command line build command:

对我有用的是将其用作命令行构建命令:

xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build

Before this, I've tried:

在此之前,我尝试过:

  • Clean the project in Xcode GUI.
  • Delete the offending pch file.
  • Delete the offending pch file's parent folder.
  • Delete the DerivedData project folder.
  • 在 Xcode GUI 中清理项目。
  • 删除有问题的 pch 文件。
  • 删除有问题的 pch 文件的父文件夹。
  • 删除 DerivedData 项目文件夹。

None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.

在 Xcode 5.0.2、Mavericks、iOS7 下,以上都不适合我。

Note that the problem didn't happen to me when using Xcode GUI.

请注意,使用 Xcode GUI 时,我没有遇到这个问题。

回答by 0oneo

I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there

我只需转到目录“/$HOME/Library/Developer/Xcode/DerivedData/”,删除那里的所有内容

回答by M_R_K

Just Click Productfrom the menu and select Clean

只需从菜单中单击产品并选择清洁

Product>Clean

产品>清洁

Worked fine for me.

对我来说效果很好。

回答by Easwaramoorthy K

I got the same problem. My error said like I need to delete the cache in the below locaition,

我遇到了同样的问题。我的错误说我需要删除以下位置的缓存,

Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W

用户/我的用户名/库/开发人员/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W

3FGETKFCU0N0Wwas a folder, when I deleted it and then clean build the project. Then the error disappears.

3FGETKFCU0N0W是一个文件夹,当我删除它然后清理构建项目时。然后错误消失。