iPhone 2.x SDKs on Snow Leopard

Posted on June 18, 2009

So, it’s been reported extensively on Twitter that the iPhone SDK package for Snow Leopard only includes SDKs for OS 3.0. This causes some problems because the SDK you build with inserts a key into your Info.plist which tells the device/store what SDK you’re targetting. This isn’t modified by the ‘iPhone OS Deployment Target’ build setting, and causes the Store to limit which devices you can install the app on, and causes the device to use 3.0-specific behaviours. This means that you WILL need to tweak coordinates and offsets to match the differences for OS 3.0, while apps build with, say, the 2.0 SDK will cause the device to emulate the behaviour of UIKit on 2.0.

There have been a few attempts to define how to make it work, but ultimately these may only work for Device SDKs, not Simulator ones. And even so, these still fall afoul of the ‘DTSDKName=iphoneos3.0’ setting created by the target SDK, so you still won’t get 2.x behaviour or be able to install on 2.x devices via the App Store.

So, after a LOT of fiddling, I have discovered the following:

  1. In the Snow Leopard OS 3.0 SDKs, you have the path usr/gcc/i686-apple-darwin10, which is symlinked to usr/gcc/i686-apple-darwin9.
  2. When building things which use and similar compiler-dependent things, the system will look inside gcc/[arch]-[vendor]-[osversion]/include for the compiler-dependent versions of those headers.
  3. On Leopard (and for the iPhone, which is based on Leopard) this looked in usr/gcc/i686-apple-darwin9/include.
  4. On Snow Leopard, the current system is Darwin version 10, so it will look in usr/gcc/i686-apple-darwin10/include. Hence the symlink.
  5. Therefore to get the older SDKs building properly (by getting access to those compiler-specific headers) you need to create the darwin10 symlink.

To do this, you basically do the following commands:

> cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/usr/lib/gcc
> sudo ln -s i686-apple-darwin9 i686-apple-darwin10

Now, unless you manually set a specific compiler in your build settings, the default when using the 2.x iPhone SDKs will be gcc 4.0.1, which works fine now. If you want to use gcc 4.2.1, you’ll need to copy[OS3SDK]/usr/lib/i686-apple-darwin9/4.2.1 and[OS3SDK]/usr/lib/gcc/i686-apple-darwin9/4.2.1 into the same places in your 2.x SDKs.

If that sounds a little fiddly, then hang in there. I’ll be distributing an app to do all that for you in a little while.

(via Alan Quatermain)

Comments are closed.

Subscribe

FREE email tips for iPhone designers and developers

Chock full of useful iPhone developer and design advice every 2 weeks. Top-notch secret advice and articles not available anywhere else.

About Bickbot.com

We are an iPhone App company that focuses on making beautifully designed apps for the Apple iPhone.

We're writers for GigaOm's TheAppleBlog.com writing tutorials for the community.

We're community enthusiasts so please feel free to contact us about iPhone app design and development.

The Bickbot tribe is

Henry Balanon
Founder & Lead Developer

John Ellenich
Lead Designer

Adrian Pittman
Director of Development

Aubrey Zimmerman
Public Relations