如何使用最新的 Xcode 下载针对较旧的 iOS 版本进行构建?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3747432/
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
How to build against older iOS versions with the latest Xcode downloads?
提问by openfrog
I have multiple versions of Xcode installed. I can build my project against older iOS versions by launching old Xcode. But how could I use newer Xcode versions to build against older iOS versions?
我安装了多个版本的 Xcode。我可以通过启动旧的 Xcode 来针对旧的 iOS 版本构建我的项目。但是我如何使用较新的 Xcode 版本来针对较旧的 iOS 版本进行构建?
In the project settings there's a Base SDK dropdown. It only offers the very latest iOS version for selection.
在项目设置中有一个 Base SDK 下拉菜单。它只提供最新的 iOS 版本供选择。
Under /Developer/Platforms/ there is an iOS.platform folder which contains this:
在 /Developer/Platforms/ 下有一个 iOS.platform 文件夹,其中包含:
SDKs/
iPhoneOS3.2.sdk
iPhoneOS4.1.sdk
And finally, there is an interesting folder called DeviceSupport, which contains a whole bunch of versions ranging from 3.0 to 4.1!
最后,还有一个叫做 DeviceSupport 的有趣文件夹,里面包含了一大堆从 3.0 到 4.1 的版本!
There must be a way to copy SDKs / DeviceSupport files from old Xcode to new Xcode and make the older ones like iOS 4.0 or even 3.0 working. How?
必须有一种方法可以将 SDK/DeviceSupport 文件从旧的 Xcode 复制到新的 Xcode,并使旧的 Xcode 像 iOS 4.0 甚至 3.0 一样工作。如何?
回答by Aaron Saunders
To make an application target that runs on multiple versions of iOS is relatively simple: Set the “Base SDK” in your projects settings to the newest version number of iOS whose features you may want. Set the “iPhone OS Deployment Target” to the oldest version number of iOS that you will support
使应用程序目标在多个版本的 iOS 上运行相对简单:将项目设置中的“Base SDK”设置为您可能需要其功能的最新版本的 iOS。将“iPhone OS 部署目标”设置为您将支持的最旧的 iOS 版本号
you will need to install older versions of xcode since the newer simulator will only support the newer ios versions
您将需要安装旧版本的 xcode,因为较新的模拟器仅支持较新的 ios 版本
回答by SteveCaine
This became harder in Xcode 3.2.5 (iOS 4.2.1) as the separate "Base SDK" values for Device and Simulator are replaced with a single "iOS SDK".
这在 Xcode 3.2.5 (iOS 4.2.1) 中变得更加困难,因为 Device 和 Simulator 的单独“Base SDK”值被替换为单个“iOS SDK”。
See my post in XCode/Simulator: How to run older iOS version?for details on how to access older Simulator SDK versions in this latest Xcode.
请参阅我在XCode/Simulator 中的帖子:如何运行较旧的 iOS 版本?有关如何在最新的 Xcode 中访问旧版 Simulator SDK 的详细信息。
回答by cschwarz
I think you should always build using the latest SDK and just set the deployment target to the appropriate version. To ensure your app runs correctly, check everything carefully on all versions and besides check the documentation if the APIs you are using have changed / removed / been deprecated in the different versions of the SDK!
我认为您应该始终使用最新的 SDK 进行构建,并将部署目标设置为适当的版本。为确保您的应用程序正确运行,请仔细检查所有版本的所有内容,此外,如果您使用的 API 已在不同版本的 SDK 中更改/删除/弃用,请检查文档!