Is it possible to get the iOS 6.1 SDK for Xcode 4.2 on Snow Leopard?
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?
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):
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.
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, (ie "6.1.2 (10B146)" or higher), use the one matching your ios device in all following instructions.
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:
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.
cd Products/Applications/yourapp.app
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
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.
plutil -convert binary1 Info.plist
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.
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"
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:
Because I should be able to develop in whatever environment I want, dammit.
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.
上一篇: Xcode进程启动失败:安全性