How do you optionally use iPhone OS 3.0 features in a 2.0 compatible app?

Solution 1:

Apple has an example of how to do this, specifically making a 2.x-compatible app that uses MFMailComposeViewController....

http://developer.apple.com/iphone/library/samplecode/MailComposer/index.html

the answer involves compiling with the 3.0 SDK, setting the deployment target to 2.x, ensuring that the 3.0 frameworks are marked as "weak" references, and then doing the right thing to make your code work if you're on a device where the new frameworks aren't present.

Solution 2:

You can always link to frameworks that are not part of the current SDK using the dlopen function. Of course, this is not recommended for frameworks that are not public (not recommended == forbidden on the app store, in this case). However, as new frameworks in unreleased versions of the OS become public, it's an option. Just check your version number, and open frameworks as available. Useful for individual features, not so much if you're making heavy use of new stuff.

Solution 3:

This probably isn't the answer you're looking for, but the method I use is to just have two separate apps. Rather than updating my existing apps with 3.0 upgrades, I just release this as a new app. Old users can use the 2.0 app for as long as they want, and people that want the 3.0 features can upgrade.