Xcode 9: how to install ios 10 sdk

北城余情 提交于 2019-12-03 17:09:39

问题


Given the fact that currently Xcode 9 is beta and the main interest today is getting knowledge of iOS 11 the question is admittedly odd...

Is there a way to target iOS 10 as base sdk while working in Xcode 9 beta? Is there need for Apple to package the SDK for Xcode 9 the same way they do for previous OS's in Xc8?

Why would one want this?

a) The first thing that comes to mind is to use Xcode 9 nice new refactoring tools on a project that involves code that needs changes from iOS 10 to 11, but has currently to run on iOS 10.

b) the sake of experimenting..


回答1:


Using this and this I was able to compile against SDK10.3 using Xcode 9 beta 4. It is possible with MANY caveats.

Caveat 1: The Xcode GUI doesn't seem capable of detecting multiple iPhone SDKs simultaneously. So you can't switch back and forth between 10.3 and 11.0 as your base SDK.

Caveat 2: The swift compiler that comes with Xcode 9 does not support targeting iPhone Simulator SDKs less than 11.0. You'll encounter this error if you try:

error: Swift does not support the SDK 'iPhoneSimulator10.3.sdk'

Caveat 3: Even if you do all of this, you still won't be allowed to submit an app with the intention of releasing it before iOS 11 is launched. The only benefit of using older base SDKs is to take advantage of certain special circumstances in the iOS platform. One notable example being background VoIP sockets and there are several other examples like it scattered throughout iOS's history.

The legacy VoIP architecture was replaced by a new PushKit-based architecture in iOS 8. It was then formally deprecated with the iOS 9 SDK. In iOS 10 it is only available as a compatibility measure; it continues to work (as well as it ever did) if your app is linked with an old SDK, but is disabled if you link with the iOS 10 SDK.

Caveat 4: You can only do it with a purely objective-C project. There seems to be some incompatibility between the 10.3 SDK and the version of the swift compiler that comes with Xcode 9. Specifically, this error:

If You're still interested

... here's how to do it.

Step 1

Replace the 11.0 SDK for Xcode 9 with the 10.3 SDK for Xcode 8.3.3 by replacing the files here:

Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

with the files from here:

Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

Step 2

Change the MinimumSDKVersion value from 11.0 to 10.3 in this file:

Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist




回答2:


Xcode 9 beta 4 allows all previous simulators to be downloaded and used. No workaround is needed any more, just download the simulator by clicking on the Download simulators menu item shown in picture (last item).

Screenshot : XCode 9 beta mixed simulator versions in list



来源:https://stackoverflow.com/questions/44985307/xcode-9-how-to-install-ios-10-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!