xcode 不小心修改了一个iOS SDK头文件,现在模拟器编译不了

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

Accidentally modified an iOS SDK header file, now I cannot compile in simulator

iosxcode

提问by mskw

I don't know how I modified a iOS SDK file, but Xcode say I did. Here is what they reported.

我不知道我是如何修改 iOS SDK 文件的,但 Xcode 说我做了。这是他们报告的内容。

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

I tried to look for this DerivedData but could not. I also went into organizer to delete it and did a clean, even after that, no luck.

我试图寻找这个 DerivedData 但找不到。我也进入组织者删除它并进行了清理,即使在那之后,也没有运气。

How do I restore this UIFontDescriptor.h to its original form?

如何将此 UIFontDescriptor.h 恢复到其原始形式?

回答by khanghoang

Remove the pcm file

删除 pcm 文件

rm "/Users/m/Library/Developer/Xcode/DerivedData/ModuleCache/24CDWDK5BTYJE/UIKit.pcm"

rm "/Users/m/Library/Developer/Xcode/DerivedData/ModuleCache/24CDWDK5BTYJE/UIKit.pcm"

then

然后

Clean Project( Cmd+Shift+K)

清理项目(Cmd+Shift+K)

Problem solved

问题解决了

回答by Jamie Forrest

I fixed this by deleting the entire contents of the ModuleCache folder:

我通过删除 ModuleCache 文件夹的全部内容来解决这个问题:

rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*

回答by lordB8r

Cmd + Shift + K

Cmd + Shift + K

Cleans the project and should fix any "accidentally touched" framework files.

清理项目并修复任何“意外接触”的框架文件。

回答by Kakashi

I fixed this by delete derived data. It work for me.

我通过删除派生数据解决了这个问题。它对我有用。

Step 1: In Xcode goto Window->Projects select your project and press delete button next to Derived data.

步骤 1:在 Xcode 中,转到 Window->Projects 选择您的项目,然后按派生数据旁边的删除按钮。

Step 2: Clean the project (Cmd + shift + K)

第 2 步:清理项目(Cmd + shift + K)

回答by Gaurav

First Clean Your project SHIFT+CMD+K or direct from product menu.

首先清理您的项目 SHIFT+CMD+K 或直接从产品菜单。

If that doesn't help, delete the derived data. 1. First go to Xcode. 2. go to Preference. 3. Tap on Locations. 4. Tap on -> above the path of Derived Data It will redirect to folder in finder. 5. Delete that Derived Data Folder.

如果这没有帮助,请删除派生数据。1.首先进入Xcode。2. 转到首选项。3. 点击位置。4. 点击派生数据路径上方的 -> 它将重定向到 finder 中的文件夹。5. 删除派生数据文件夹。

It is working for me.

它对我有用。

回答by iOSdev

While building your app it will show the errors right.Go to the error description and it will show the path to delete the cache files.select the path and go that folder in folder options and then delete the cache.clean the project and build it.run the app it will run successfully

在构建您的应用程序时,它将正确显示错误。转到错误描述,它将显示删除缓存文件的路径。选择路径并转到文件夹选项中的文件夹,然后删除缓存。清理项目并构建它.run 应用程序,它将成功运行