如何在 XCode 中安装特定的 iPhone 模拟器 SDK 版本?

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

How do I install a specific iPhone simulator SDK version in XCode?

iosxcodeios-simulator

提问by user2719094

A couple weeks ago I was working on a project that referenced the iPhoneSimulator 8.2 SDK. Today I went to continue work on the project and suddenly I can't run the simulator. I receive the following error message:

几周前,我正在研究一个引用 iPhoneSimulator 8.2 SDK 的项目。今天我去继续做这个项目,突然我不能运行模拟器了。我收到以下错误消息:

ERROR! Can't locate iPhoneSimulator SDK 8.2 at `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk'

错误!无法在“/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk”中找到 iPhoneSimulator SDK 8.2

Sure enough, the simulator SDK doesn't exist in that directory anymore. So I opened up XCode, went to the downloads window and saw it wasn't installed anymore. I have no idea how that happened, but I'm guessing XCode updated itself and removed it. So, I download and install the 8.2 SDK again. However, when it finished, my project still wouldn't run: I received the exact same error. Upon inspection of the file system, I see that XCode actually installed the 8.3 SDK, not 8.2, even though the XCode GUI says it installed 8.2.

果然,模拟器 SDK 不再存在于该目录中。所以我打开 XCode,转到下载窗口,发现它不再安装了。我不知道这是怎么发生的,但我猜 XCode 自我更新并删除了它。所以,我再次下载并安装了 8.2 SDK。但是,当它完成时,我的项目仍然无法运行:我收到了完全相同的错误。在检查文件系统时,我看到 XCode 实际上安装了 8.3 SDK,而不是 8.2,即使 XCode GUI 说它安装了 8.2。

I'm running XCode 6.3 (which is weird because I see 6.3 was only released a couple days ago and I haven't installed or upgraded XCode in over a month).

我正在运行 XCode 6.3(这很奇怪,因为我看到 6.3 仅在几天前发布,而且我已经一个多月没有安装或升级 XCode)。

Is there a way to download a specific version of the iPhoneSimulator SDK and manually install it?

有没有办法下载特定版本的 iPhoneSimulator SDK 并手动安装它?

回答by Jeremy Huddleston Sequoia

You run an iOS Simulator runtime in the iOS Simulator You build against an iOS Simulator SDK.

您在 iOS 模拟器中运行 iOS 模拟器运行时您针对 iOS 模拟器 SDK 构建。

Unfortunately this is confusing because the SDK and runtime are located at the same place inside the Xcode.app bundle.

不幸的是,这令人困惑,因为 SDK 和运行时位于 Xcode.app 包内的同一位置。

What you want to do is build against the latest iOS Simulator SDK (iOS 8.3 as of Xcode 6.3) and run your app in a simulated device with the iOS 8.2 simulator runtime.

您要做的是针对最新的 iOS 模拟器 SDK(iOS 8.3 自 Xcode 6.3)进行构建,并在具有 iOS 8.2 模拟器运行时的模拟设备中运行您的应用程序。

You can install the iOS 8.2 simulator runtime from within Xcode by going to Xcode -> Preferences -> Downloads.

您可以通过 Xcode -> Preferences -> Downloads 从 Xcode 中安装 iOS 8.2 模拟器运行时。