Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Older iOS SDKs to Xcode 4.1 in Lion

I just installed Lion and Xcode 4.1. How do I add older SDKs so I can build and run in 4.1 or 4.2 in iPhone/iPad Simulator? Xcode 4.1 only comes with the iOS 4.3 SDK.

Does Lion have some sort of minimum SDK for builds?

Thanks,

like image 503
Rafeed C. Avatar asked Jul 21 '11 21:07

Rafeed C.


3 Answers

Actually it is possible to add older SDKs as long as you can still get your hands on an older version of Xcode with the older SDK. It's useful too sometimes: when you do this you get to find out about unsupported constants and methods you may be using during compile rather than at runtime. Here's how to do it.

  1. Get hold of an older version of Xcode with the older SDK. The Apple iOS Dev Center currently lists the 4.3 SDK with the Xcode 3.2.6 download.

  2. Mount the dmg and open up the Packages folder hidden within the dmg via Terminal:

    open /Volumes/Xcode\ and\ iOS\ SDK/Packages/

  3. Double click the pkg file for the SDK version you want. I was looking for iPhoneSDK4_3.pkg but, in addition to 4.3, found packages as old as iPhoneSDK3_0.pkg. So perhaps older SDKs may still be packaged with the App Store download if you know where to find it (I didn't).

  4. Let it install in it's own folder of choice since you won't be able to force it to install in Applications/Xcode.app/Contents/Developer (which is where the Developer folder is now)

  5. You'll find the package installed in the Platforms folder in the volume you chose. Move the relevant SDK over to the Developer folder within Xcode.app. You'll likely have to use sudo:

    sudo mv /Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

  6. Restart Xcode and you should see the new (old) SDK listed in your options for Base SDK. Yay!

Update as of 12 Sep 2013

If the "older SDK" you're trying to add comes bundled in Xcode 4.3 or later, adding the SDK is as simple as downloading Xcode from dev center link that says "Looking for an older version of Xcode?" (currently points here), mounting the dmg, then copying the relevant files over.

In terminal, you'd do something like this (edit for the appropriate SDK version number):

cp -R /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

For SDKs from versions of Xcode prior to 4.3, the older steps are still relevant.

I found this happens to work for getting the Xcode 5 GM to compile builds that carry the old iOS 6 UI even when deployed on iOS 7 devices. Useful for fixing bugs pending a UI redesign. That said, there's got to be an easier way to get the iOS 6 UI on an iOS 7 device.

like image 144
nioq Avatar answered Nov 13 '22 01:11

nioq


You can't. What you can do, however, is click on the top-level entry in the File Navigator. It'll take you to the application settings. Go to the tab called Build Settings, and change the iOS Deployment Target to whatever version of iOS you'd like to support from (the earliest version you support).

See "To Edit a Build Setting…": http://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Building/Building.html#//apple_ref/doc/uid/TP40010215-CH9-SW5

like image 8
FeifanZ Avatar answered Nov 13 '22 00:11

FeifanZ


Open Xcode and open Preferences (Xcode -> Preferences menu). Click the Downloads icon and look in the Components tab. All versions from 3.0 to 5.1 should be available. Just click Install for the ones you want to use.

like image 8
2cupsOfTech Avatar answered Nov 12 '22 23:11

2cupsOfTech