26

I'm running into compatibility issues for some external frameworks I'm using in my project. Is there a way to change the Base SDK on Xcode 8? Currently in the project settings only show me the Latest SDK.

I've tried copying the older SDK from another version of Xcode to here but it didn't work:

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

tonik12
  • 613
  • 1
  • 7
  • 25

3 Answers3

31

Starting with Xcode 7.3, in addition to copying in the SDK, you must also edit a certain Info.plist file, as described here for macOS in the post by agx. It looks like there is a similar file for iOS, at

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

Try changing the value of MinimumSDKVersion in there from 10.0 to whatever SDK version you want.

I've not tried this with iOS, but, using this workaround, I was just able to build a macOS target with macOS 10.6 using Xcode 8.0 (8A218a) (the "GM").

UPDATE

The hack described above stopped working for me in Xcode 9. If you want to use Xcode 9+, see my more recent answer dated Nov 22, 2017.

Community
  • 1
  • 1
Jerry Krinock
  • 4,860
  • 33
  • 39
  • 1
    I can confirm this works for iOS as well. Keep in mind if you want to build for the simulator you'll need to perform the same steps for the `iPhoneSimulator.platform`. – dcow Sep 13 '16 at 22:37
  • 1
    This helps me build a version for iOS 9.3 instead iOS 10 with Xcode 8. Thanks! – jfmg Sep 23 '16 at 12:15
  • Thanks, that really helps. Interestingly though, when doing this, you can't set the deployment target on the info tab to 10.1 from a present, so you need to type it – Julian F. Weinert Jan 02 '17 at 23:11
  • 1
    Aaaand the target device appears twice in the list... But that's the deal with workarounds anyway – Julian F. Weinert Jan 02 '17 at 23:12
  • 1
    @JulianF.Weinert The top device entry is actually building against your target SDK and the bottom device entry is building against the latest SDK. – MechEthan Apr 06 '17 at 19:42
  • This was remarkably useful, worked for iOS 9.3 on Xcode 8.3.2 for me. BTW: Specifically, I copied the iPhoneOS.sdk and iPhoneSimulator.sdk from the old XCode into a temp folder, renamed them to "iPhoneOS9.3.sdk" and "iPhoneSimulator9.3.sdk", then installed XCode 8.3.2, then copied those sdk files into /Contents/Developer/Platforms//Developer/SDKs/ (where is iPhoneOS.platform or iPhoneSimulator.platform; then edited both Info.plist files as mentioned, then restarted XCode. And voila! – DanM Apr 21 '17 at 19:44
  • 1
    DanM: I have installed both Xcode 7.2.1 and Xcode 8.2.1. I copied Xcode 7.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk to Xcode 8.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs and Xcode 7.2.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk to Xcode 8.2.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/. I also modified 2 Info.plist under iPhoneOS.platform and iPhoneSimulator.platform with the MinimumSDKVersion to 9.2. But still don't see 9.2 in the Base SDKs – tala9999 May 25 '17 at 13:28
  • In addition, when I build the app, I get the error "Swift does not support the SDK iPhoneSimulator9.2.sdk" – tala9999 May 25 '17 at 14:48
  • Hoping this helps others walking down memory lane. I had to get iPhoneOS SDK 6.1 working with Xcode 8. In addition to the above tips (download SDK 6 from Apple, copy/paste the iPhoneOS.platform and iPhoneSimulator.platform files and edit the two Info.plist files), I had to copy across the iPhoneOS.platform/DeviceSupport/6.1 directory before Xcode allowed me to build for an actual, attached iPhone 3GS. However, I couldn't get an iPhone 3 to appear in the simulator. Hoping someone else can post the magic incantation :( – pete Sep 13 '18 at 19:13
8

My original answer, although it worked with Xcode 8, for some strange reason which is not worth explaining, no longer works with Xcode 9 on a particular client's old project. So I've been using an alternative workflow which is really not too bad.

To work on this project, I open it in both the older Xcode, which can build it with the required SDK, and in a recent Xcode. I put the old Xcode window in the background and do my work in the recent Xcode. When I am ready to test changes, I do a File > Save All (⌥⌘S), then switch to the old Xcode and Build (⌘B). When the build is done, I switch back to the recent Xcode and Product > Perform Action > Run without Building (⌃⌘R). Because the dSYM file format has not changed, breakpoints work as expected.

The advantages are that no hacking of Xcode is required, and the only thing I need to remember about the old Xcode (Xcode 3 in my case) is, mercifully: ⌘B.

One little warning: In this particular project's Target, in Build Settings, it has a custom Build Products Path. This is typical of the way Mac apps were built years ago. To ensure that both of your Xcodes are working with the same product, if your old and recent Xcodes straddle the version which changed the default Build Products Path, you may need to set Build Products Path.

The workflow could probably be made even easier by scripting the xcodebuild and xcode-select command line tools, but this is good enough. With Apple's announcement at this year's WWDC about support for 32-bit Mac apps going away during the next two years, my client has some tough decisions ahead in any case.

Jerry Krinock
  • 4,860
  • 33
  • 39
0

You just have to change the "Deployment Target" settings. You basically use the latest available SDK as base SDK but select a target OS X version. Of course it depends on why you want to use an older SDK?

asdf
  • 952
  • 14
  • 13
  • 2
    One reason for using an older SDK is to avoid Apple’s auto-opt-in assumptions based on which SDK you have linked against. Especially since these assumptions are often very hard to find out about except the hard way. – Peter N Lewis Jul 25 '18 at 03:19