如何将 UIKit 添加到 Xcode 项目?

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

How to add UIKit to an Xcode project?

xcodeuikit

提问by MonkeyBusiness

I've imported another programmer's project into Xcode and get the error "UIKit/UIKit.h file not found." I tried right clicking the Frameworks folder but didn't see a way to add it. How can I add the UIKit to this project?

我已将另一个程序员的项目导入 Xcode,并收到错误“未找到 UIKit/UIKit.h 文件”。我尝试右键单击 Frameworks 文件夹,但没有看到添加它的方法。如何将 UIKit 添加到该项目?

采纳答案by dasdom

Navigate to the target and go to Build Phasesand add UIKit to Link Binary With Libraries.

导航到目标并转到Build Phases并将 UIKit 添加到Link Binary With Libraries.

From the Comments to this post:

从评论到这篇文章:

MonkeyBusiness: Sorry to waste your time. I had set the project up as MacOS rather than iOS. I'm new to Apple and iOS as you can see.

MonkeyBusiness:很抱歉浪费您的时间。我已将项目设置为 MacOS 而不是 iOS。如您所见,我是 Apple 和 iOS 的新手。

回答by user151019

Check that you are using a iOS project and not a Mac OSX one - UIKit is only for the iPhone/iPad

检查您使用的是 iOS 项目而不是 Mac OSX 项目 - UIKit 仅适用于 iPhone/iPad