1

I know this worked with ios 6.0 following these steps Is it possible to get the iOS 5.1 SDK for Xcode 4.2 on Snow Leopard? but it doesnt appear this is possible now. Does anyone know a workaround or should i just upgrade?

Community
  • 1
  • 1
Landon
  • 787
  • 1
  • 9
  • 19
  • 1
    Upgrade to Lion (assuming you can't upgrade to Mountain Lion) then you can install Xcode 4.6. – rmaddy Feb 21 '13 at 02:35

1 Answers1

8

Still possible. In fact, you can do all the development and submit applications to Appstore using XCode 4.2 on Snow Leopard with SDK 6.1. However, you can't run simulator 6.1 (so use a real device).

Here is how (a few steps abbreviated):

  1. You will need to find a system with Lion/Mountain Lion and XCode 4.5, which you will use as a source of data (I have one in VMWare). IMPORTANT: You will need to connect an iOS device running ios 6.1 to that system and open it in XCode 4.5 organizer, so that XCode can download appropriate symbols.

  2. From system with XCode 4.5 copy the following source directories:

    Device Support: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/6.1 (10B141)

    SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk

    It may be most convenient to archive each directory using tar, like so: tar cvf /tmp/archive.tar << name of your directory >>

    NOTE: specific version of Device Support directory may differ, (i.e. "6.1.2 (10B146)" or higher), use the one matching your ios device in all following instructions.

  3. You will need to copy these directories to the Snow Leopard system with XCode 4.2 into the following directories (assuming your XCode installation is in /Developer. If, like mine, it's somewhere else, replace first component of the path as needed):

    Device Support: /Developer/Platforms/iPhoneOS.platform/DeviceSupport/

    SDK: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs

    If using tar, change into each directory and extract its respective tar archive like so: tar xvf /tmp/archive.tar . Using tar has an advantage of preserving timestamps, symbolink links etc, if there are any.

    After copying, remove link "Latest" in Device Support directory and re-link to "6.1 (10B141)" like so: ln -s "6.1 (10B141)" Latest

==============================================

At this point you can restart XCode 4.2 and you should be able to:

  • Add your 6.1 device in organizer, and run and debug code on it

  • Select 6.1 SDK as "latest" for your projects and build against it.

==============================================

However, if you are trying to support a 4" iPhone 5 screen (by adding Default-568h@2x.png startup image) you still can't quite submit an application built that way to the Appstore. XCode 4.2 embeds SDK 5.0 into some of the metadata in the application archive, so it looks like the application is built against 5.0 sdk. Appstore actively refuses binaries that include 4" screen support and are not built against 6.0 or higher SDK.

So, you must resort to some manual work to tell Appstore what is already true :)

Here is how:

  1. Archive your application. Open archive directory in finder (right click on the line, "reveal in finder"), open Terminal, type "cd ", drag and drop the directory to Terminal and press "Enter". Now you are in that directory and can work with files there.

  2. cd Products/Applications/yourapp.app

  3. There will be a file called Info.plist - it's in a binary form. Convert it to XML like so: plutil -convert xml1 Info.plist

  4. Open Info.plist in your favorite editor. Find references to sdk 5.0 (or binary value of SDK) in the following entries and replace with references to 6.1: DTPlatformVersion: 6.1 DTPlatformBuild: 10B141 DTSDKBuild: 10B141 DTSDKName: iphoneos6.1

If you feel adventurous, replace XCode version and build values too. I did not.

  1. plutil -convert binary1 Info.plist

  2. Now you need to re-sign the application. Application binary is in the same folder, should be named "yourapp"

To do so, you will first need a copy of embedded entitlements file that is to be used during signing.

  • You can either copy that file from an application archive made under XCode 4.5: look for file name: archived-expanded-entitlements.xcent , copy to the application directory (just in case, not sure if needed)

  • extract it from current application like so: codesign -d --entitlements /tmp/entitlements.xml "yourapp"

Open file /tmp/entitlements.txt in text editor and clean up any weird stuff that goes before < ?xml version tag, save.

  1. Now find the exact name of your distribution certificate. You can copy it from a number of places, but the best is to open Keychain Access app, select the distribution certificate, doube-click to open properties and copy "common name". It should be something like "iPhone Distribution: your company"

  2. Still in the archive directory, run codesign as follows: First remove current signature file just in case:

    rm -rf _CodeSignature

    Then run:

    codesign -f -s "iPhone Distribution: your company" --entitlements /tmp/entitlements.xml yourapp

This is it. Your application is now built against 6.1 SDK and shows as such. You should be able to validate and submit it to appstore from Organizer.

============================

Disclaimer: my app submitted this way is still "Waiting for Review". Will post here if it is accepted/rejected because of this.

Note: so why jump through these hoops? Well, a few reasons:

  1. Because I should be able to develop in whatever environment I want, dammit.

  2. XCode 4.2 on OSX 10.6 is the last version of XCode that supports PowerPC and OSX 10.4 SDK. If, like me, you have to support an old desktop product that must run on that platform - you have no choice, but to stick with it until last PowerPC user drops his device. These guys are old and tenacious. Using two machines for development is not an attractive option for me.

Han
  • 81
  • 3
  • Very nice explanation, and I confirm I can use the SDK6.0 in xcode 4.2 and run my apps on my ipad mini. I am very interested to know if your app will be accepted or rejected : I have too an app available on the appstore, which is running on devices from iOS 3.1.2 to iOS 5.1, with full support of iPhone 5 retina 4" screen. It has been compiled with xcode 4.2 and added just before apple start to refuse apps compiled with SDK 5.0 that include 4" screen support. So, I would like to make updates for this app, and for now, i can't because it will force me to drop support of armv6 (2nd gen) devices. – Chrysotribax Mar 09 '13 at 09:48
  • UPDATE: app built in this manner was accepted to Appstore. All good. – Han Mar 14 '13 at 19:59
  • One more note. After a period of inactivity, I found that XCode 4.2 will no longer recognize my iOS 6.1 device (in Organizer, so could not run/debug app on it). I had to connect the device to newer XCode (4.3) running on OSX 10.7 Lion, get it recognized in Organizer there, then disconnect and reconnect to XCode 4.2 - after which the device was recognized again. Perhaps some sort of device initialization that XCode 4.2 cannot perform. – Han May 21 '13 at 22:48