tags:

views:

3194

answers:

3

The current (as of Dec 2008) iPhone SDK allows me to pick between 3 versions when I want to build an app: 2.0, 2.1, 2.2. -- I'll ignore 2.1 below.

My assumptions:

  • 2.2 has more API functions available than 2.0,
  • 2.2 has fixed bugs since 2.0,
  • 2.2 is backward-compatible with 2.0 (both for building and running),
  • If I build with SDK 2.0, my app will work on iPhone 2.2,
  • If I build with SDK 2.2, my app won't work on iPhone 2.0.

I would think that using the earliest version that can build the app would be best, this way it will run on iPhones running older OSes.

But is there a risk that my app would be missing something if I built it with 2.0? Maybe some speed or nicer UI elements. But maybe there's not that much difference between 2.0 and 2.2 to even worry about it?

So my question is: Which SDK should I select?

  1. The earlist SDK I can build with, to broaden my target market.
  2. The latest SDK always, so that my app benefits from improvements -- at the cost of potentially reducing my market.

(And if the answer is obvious, why do I have a choice?!)

+2  A: 

I'd pick option #1 - compile it to 2.0. This is what we do for our app. There are still a lot of people running the old 2.0 O/S and if you compile to 2.2 your app won't run on their device.

That said, if you develop your app and run into a bug and find out that it's been fixed in a later firmware version, you may not have much of an option unless there's a workaround. There are also new features added to each new version although I do not know of a comprehensive list of what those features are (at an API level).

Marc Novakowski
Note that there are changes in 3.0 that are not compatible with 2.0 apps (in the beta at least). I think it's not as easy as just lowest commone denomiator although Marc's advice is good.
Roger Nolan
+27  A: 

You can use the iPhone OS 2.2 SDK and still compile for iPhone OS 2.0; the way you do this is the same as for Mac OS X. The SDK you use determines the most recent version of the OS you want to use API from, while the Deployment Target you use determines the least recent version of the OS you want to run on. Both of these should generally be set at the project level in Xcode.

So you can build your software against the iPhone OS 2.2 SDK and, when running on devices with 2.2 or later installed, use 2.2 features. But you can set its Deployment Target to 2.0 and not use 2.2 features when running on a device with a pre-2.2 operating system installed and your application should work fine.

Chris Hanson
Your answer really should be the accepted one here, it's definitely the best one! Even long time developers lack that knowledge. And as you implied, if you dynamically decide which features to use (at runtime, not at compile time), you can use 2.2 features and still run on 2.0 (just don't try using those features there). We do the same to use 10.5/10.6 features and still run on 10.4.
Mecki
@Mecki: so in essence you build a single application with N code paths inside, either enabling / disabling features per OS revision, or implementing them differently for different versions? Yikes...but who said backwards compatibility was easy!
Bogatyr
@Bogatyr: Either way. You can decide that feature A only works if OS is >10.5. So you have 10.5/10.6, this feature works, you have 10.4, it does not. Or you can offer alternative code; in 10.5/10.6 the view changes with a beautiful animation, in 10.4 it just "swaps" (there is no loss in functionality, it just looks less beautiful). Usually it is just a single if, checking OS version and then either do this or do that and do that can either be nothing or a message "not supported" or it can be a less elegant, but functional equivalent alternative.
Mecki
A: 

In my testing, if you use 2.0 you can't make use of the application badge functionality - that appears in 2.1 (so you may need to at least use that level)

Tim

TimM
I was able to use the badge functionality with a 2.0 build. Documentation says that UIApplication.applicationIconBadgeNumber is "Available in iPhone OS 2.0 and later." Or are you referring to something else?
squelart