Thursday, September 26, 2013

How to compile iOS code for iOS 6 in Xcode 5


Xcode 5 has been introduced with a lot of changes including the support for iOS 7. Even though we do not want to stick with the old iOS versions, there is a transition time for us to upgrade our apps to the new SDK 7, and till then you may want to make builds for the old iOS versions using the new Xcode 5. This blog post provides some simple steps to build your iOS app in multiple iOS SDKs using Xcode 5

Back-up the old SDKs

Before upgrading to Xcode 5, remember to back-up your old Xcode to be used later (let simply rename it to be Xcode4.app), otherwise it will be overwritten. If you forgot to do that, you will need to re-download the old version here, then rename, copy the Xcode.app into your local place to refer to later (eg: /Applications/Xcode4.app)

Setting things up

After getting the Xcode 5 installed on your Mac, the Applications directory could typically look like this

Now go to your old Xcode4.app to copy the SDK over to the new one, something like this:

$ cp /Applications/Xcode4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS

Or you may simply create a link to your old SDK like this:

$ ln -s /Applications/Xcode4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk


Now in your Xcode 5 >> Build Settings >> Base SDK you can decide which SDK you want to use for building your app.



Downloading the old simulator(s)

If you forgot to back-up your old Xcode before upgrading, you still can download the old simulator by going to Xcode >> Preferences >> Download



No comments: