ios 无法构建模块 UIKit

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

Could not build module UIKit

iosiphoneuikitxcode5

提问by Hardik Shah

Suddenly it stops building application in device. In simulator its working but when I connect the device and try to run it in device it gives me an error:

突然它停止在设备中构建应用程序。在模拟器中它可以工作,但是当我连接设备并尝试在设备中运行它时,它给了我一个错误:

Could not build module UIKit

无法构建模块 UIKit

I tries a lot but couldn't solve it.

我尝试了很多,但无法解决。

回答by Raphael Oliveira

A full clean + deleting the derived data worked for me.

完全清理 + 删除派生数据对我有用。

Be sure to fix any code that may be broken because UIKit cannot be installed, before the clean and build.

在清理和构建之前,请务必修复由于无法安装 UIKit 而可能损坏的任何代码。

So, for example, if you are trying to reference UICollectionViewController, and need UIKit to reference it, comment out the code that is using UICollectionViewController, comment out the import for UIKit.

因此,例如,如果您尝试引用 UICollectionViewController,并且需要 UIKit 引用它,请注释掉使用 UICollectionViewController 的代码,注释掉 UIKit 的导入。

Then clean, build. Now uncomment import UIKIt, build. NOW uncomment UICollectionViewController code, build again.

然后清理,构建。现在取消注释 import UIKIt,构建。现在取消注释 UICollectionViewController 代码,重新构建。

回答by chinnawatp

Please don't make the same mistake like I did. In my case, I accidentally typed some words into Foundation framework file.

请不要像我一样犯同样的错误。就我而言,我不小心在 Foundation 框架文件中输入了一些单词。

回答by abinop

Something that might help would be to set the Derived Data location to "Relative" in XCode preferences, then Clean & Build

可能有帮助的事情是在 XCode 首选项中将派生数据位置设置为“相对”,然后清理并构建

XCode derived data location

XCode 派生数据位置

回答by tamir007

For some reason your UIKit.framework is corrupted, either copy a working UIKit.framework from somewhere else into

由于某种原因,您的 UIKit.framework 已损坏,请从其他地方复制一个有效的 UIKit.framework 到

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks

Or reinstall Xcode the fix the issue.

或重新安装 Xcode 以解决问题。

回答by Lal Krishna

I accidentally edited the Foundation framework file so UIKit.frameworkgot corrupted. The only solution is recover the original.

我不小心编辑了 Foundation 框架文件,因此UIKit.framework损坏了。唯一的解决办法是恢复原件。

You have two solutions: Just reinstall XCode or copy the Framework from another machine with the same XCode version and paste into yours.

您有两种解决方案:只需重新安装 XCode 或从另一台具有相同 XCode 版本的机器复制框架并粘贴到您的机器中。

Location:

地点:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks

回答by vikas prajapati

If you have two Xcode then uninstall both and again install Xcode. It worked for me.

如果您有两个 Xcode,则卸载它们并再次安装 Xcode。它对我有用。

回答by Yedidya Reiss

If cleaning the project and deleting the 'derived data' doesn't work, try to change the 'Deployment target' (at 'General' tab) from 7.0 to 7.1

如果清理项目并删除“派生数据”不起作用,请尝试将“部署目标”(在“常规”选项卡中)从 7.0 更改为 7.1

回答by Sazzad Hissain Khan

Check whether the appropriate target is selected or not from the "active scheme selector". Selecting "Generic iOS Device" solved my problem.

检查是否从“活动方案选择器”中选择了适当的目标。选择“通用 iOS 设备”解决了我的问题。

Click to select simulator

点击选择模拟器

enter image description here

在此处输入图片说明

Select "Generic iOS Device":

选择“通用iOS设备”:

enter image description here

在此处输入图片说明

回答by psobko

Make sure none of the files are edited in the UIKitframework located inside Xcode.

确保没有在UIKit位于 Xcode 内的框架中编辑任何文件。

回答by hsafarya

Cleaning Derived data worked for me

清理派生数据对我有用