xcode UIKit 无处可寻?

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

UIKit is nowhere to be found?

objective-cxcodemacosuikit

提问by thesublimeobject

I can't find UIKit.framework anywhere: it's nowhere in my /System/Library/Framework and I can't add it via Build Phase because it's not there to select. I have installed and re-installed xcode and it's not showing up. It doesn't seem to be directly downloadable either. Any ideas?

我在任何地方都找不到 UIKit.framework:它在我的 /System/Library/Framework 中无处可寻,我无法通过 Build Phase 添加它,因为它不在那里可供选择。我已经安装并重新安装了 xcode,但它没有显示出来。好像也不能直接下载。有任何想法吗?

采纳答案by Departamento B

If this is indeed meant to be a question for a Mac OS X application instead of an iOS application @Ken Thomases reply is true. If this question is about making an iOS application with Xcode on Mac OS X then it might be possible your project file is a bit broken. I had to deal with this some weeks ago when all of a sudden I could not add an audio framework.

如果这确实是针对 Mac OS X 应用程序而不是 iOS 应用程序的问题,@Ken Thomases 的回答是正确的。如果这个问题是关于在 Mac OS X 上使用 Xcode 制作 iOS 应用程序,那么您的项目文件可能有点损坏。几周前我不得不处理这个问题,突然我无法添加音频框架。

  • Open Xcode but close all windows so no projects are open
  • Press CMD-SHIFT-2 to go to the Organizer
  • Go to Projects
  • Select your project
  • Press on the Delete button on the line of Derived Data
  • Restart Xcode
  • Open your project
  • Wait until your project has been analyzed
  • 打开 Xcode 但关闭所有窗口,因此没有打开任何项目
  • 按 CMD-SHIFT-2 进入管理器
  • 前往项目
  • 选择您的项目
  • 按派生数据行上的删除按钮
  • 重启Xcode
  • 打开你的项目
  • 等到你的项目分析完毕

Alternatively you can show the contents of the package of your project file by CTRL-clicking it and selecting Show Package Contents. There are a lot of user based files there, some might be corrupt. Throw these files away and try again. Backup just to be sure.

或者,您可以通过按住 CTRL 键单击它并选择“显示包内容”来显示项目文件的包内容。那里有很多基于用户的文件,有些可能已损坏。扔掉这些文件,然后再试一次。备份只是为了确定。

Your project's settings should look something like this: enter image description here

您的项目设置应如下所示: 在此处输入图片说明

Build phases:

构建阶段:

enter image description here

在此处输入图片说明

It's important that you target iOS and that UIKit and Foundation are there

重要的是你的目标是 iOS 并且 UIKit 和 Foundation 在那里

If they're not, try to create a new project

如果不是,请尝试创建一个新项目

回答by KiRviz

Make sure you have the right Platform set under Playground Settings

确保在 Playground Settings 下设置了正确的 Platform

Playground settings under Utilities Pane

实用程序窗格下的游乐场设置