Xcode 9: how to install ios 10 sdk
Asked Answered
D

2

11

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..

Dick answered 8/7, 2017 at 10:45 Comment(3)
It's unclear what you're trying to ask here. It is certainly possible to use Xcode 9 to develop on iOS 10. Just make sure your deployment target is set to iOS 10.Tierney
Well, I wanted to see if using Xcode 9 beta there was already a way to add previous iOS SDKs, like you can do in the release version...Dick
It's probably not foreseen for the beta period...Dick
T
11

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:

enter image description here

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

Tierney answered 1/8, 2017 at 16:3 Comment(5)
It seems there may have been a confusion in your question. There is a major difference between "base sdk" and "deployment target". This answer specifically address changing the base sdk. Changing the deployment target is trivial.Tierney
Thanks! I successfully launched my app on iPhone X simulator with 10.3 SDK. Just changed iPhoneOS.platform to iPhoneSimulator.platformAweless
@AllenHumphreys Why not keep both SDK's and just change the path of the symlink? 🤷‍♂️Forked
@Chris That seems like it could work, but this was a long time ago so I don't think I'll be reproducing it to make sure it works.Tierney
@AllenHumphreys that's what I did, and I was able to use the 10.3.x SDK provided by Xcode 8.3.3 to build iOS apps.Forked
P
1

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

Preciado answered 9/8, 2017 at 8:23 Comment(4)
Thanks for sharing. Still, for me, this is less about testing on a simulator and more about the changes in compiling for iOS 10 rather than 11. There are some significant changes (top layout guides for one) that make it desirable to continue to compile your app for iOS 10 for the time being, not just test in other simulators.Destructible
But Xcode 9 is perfectly capable of compiling for ios 10 also. I've been using it to compile 10.3 target. What will happen if you chose 10.3 target is instead of swift 4 the compiler will call itself swift 3.2 (which is swift 4 compiler working in swift 3 compatibility mode.) Is this what you're trying to do or am I misinterpreting your comment?Preciado
Targeting 10.3 does very little, and the Swift language version has nothing to do with it. You can target 10.3 with Swift 4 without issue. The thing in question is which version of the system libraries your binary is linked against at compile time.Tierney
You're right. I was only thinking about testing on previous iOS versions, not compiling against older SDKs.Preciado

© 2022 - 2024 — McMap. All rights reserved.