xcode 无法解决“无法构建模块“UIKit”

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

Can't solve "Could not build module "UIKit"

iosobjective-ciphoneswiftxcode

提问by zmbdr

On the way to develop iOS app in Objective-C and writing some code, Suddenly the error "Could not build module "UIKit" appeared.

在用Objective-C开发iOS应用,写一些代码的过程中,突然出现“Could not build module”UIKit”的错误提示。

The errorOpening the other Xcode project, same error caused.

错误打开另一个 Xcode 项目,导致同样的错误。

(Xcode version is 7.3)

(Xcode 版本为 7.3)

I have done them

我已经完成了

?Clean(Cmd + K)

?清洁(Cmd + K)

?Clean Build Folder

?清理构建文件夹

?Delete DerivedData

?删除派生数据

?Remove and add UIKit.framework

? 删除并添加 UIKit.framework

?Set the "Allow Non-modular Includes in Framework modules" setting to YES

?将“允许非模块化包含在框架模块中”设置为是

How can I solve it?

我该如何解决?

回答by DawnSong

The command rm -rf ~/Library/Developer/Xcode/DerivedData/*to clear cache thoroghly solved my problem.

rm -rf ~/Library/Developer/Xcode/DerivedData/*清除缓存的命令完全解决了我的问题。

回答by Prabhat Pankaj

Import #import in every class where you are getting error.

在遇到错误的每个类中导入 #import。

回答by Dinesh Kumar Vyas

Try creating some demo project and check if same error coming in new project? and if the error remain same then you will need to uninstall the Xcode and re-install it.

尝试创建一些演示项目并检查新项目中是否出现相同的错误?如果错误仍然相同,那么您将需要卸载 Xcode 并重新安装它。

回答by mahmutpinarbasi

Setting Framework Search Pathsmiscorrect causes the same error. Check your Framework Search Pathsand be sure it's setup correctly.

设置框架搜索路径不正确会导致相同的错误。检查您的框架搜索路径并确保其设置正确。

回答by Ravi Panchal

try To import UIKitin UIColor.hclass and other classes where it require, in my case i have solved with this single line.

尝试UIKit在需要的UIColor.h类和其他类中导入,在我的情况下,我已经解决了这一行。

#import <UIKit/UIKit.h>

if you still face issue so please let me know.

如果您仍然遇到问题,请告诉我。