James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


How to setup Xamarin Studio for iOS 6 Support

James MontemagnoJames Montemagno

Even though iOS 7 has been dominating the market and is now on over 75% of iOS devices, it might still be important for you or your company to support iOS 6. It was for me recently when I was developing Puppy Kitty Overflow as my girlfriend is unable to upgrade her phone and I wanted to ensure she could run the app. So I sent out on a quest to get iOS 6 support working in the latest version of Xamarin Studio and XCode 5.

Get the old SDK

First things first, you will need to download the old version of XCode from the Apple Developers page to get the iOS 6 SDK. Go to the downloads page and then find XCode 4.6.3 and download it. It is important to NOT install this, we just want to explore it to find the SDKs. To do so double click the .dmg file. It will mount the .dmg and will ask you to drag it to Applications. Do NOT do this, simply command + click the XCode icon and select display contents.

First copy:

Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk

to

Second copy:

Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk

to

After that when you create a new project you will want to do a few things:

  1. Open Project Options
  2. Under iOS Build set SDK version to “Default
  3. IMPORTANT: Set Link behavior to: Link SDK Assemblies Only
  4. Under iOS Application set “ Deployment Target” to 6.1


When you open up XIB files to edit inside of XCode they will default to supporting version 7.0 only, however you can change this under “Identity and Type” on the main view with these settings:

This will also allow you to go back and view this in an older Xcode version as well.

After that you should be all setup to build for both iOS 6 and iOS 7!

There are a few thing to be aware of. When you are developing for both versions of iOS if you want to use anything specific in iOS 7 you will want to ensure you check the version numbers before actually calling the new APIs. Failure to do this will cause you app to crash :(. Here is a helper method that I use:

To make your life really easy you can also turn on Xamarin Studio’s code inspection which will notify you with a green squigly that the API you are referencing is only iOS 7:

Live, Love, Bike, and Code

Comments