Adding iPhone OS 3.x Features to Your iPhone OS 2.x-compatible Apps

Tue, 08 Dec 2009 19:19:59 -0500
apple, developer, ios, ipad, iphone, ipod, objective-c

You can add great new iPhone OS 3.x features to your application — In App Purchase, Push Notifications or the mail compose view — while maintaining compatibility with iPhone OS 2.x.

By using "weak linking" in your Xcode project, you can include frameworks you'll need for the newer features, and check for API availability when your application is running. This technique provides you with the broadest possible audience for your application. You can offer a game that runs great on iPhone OS 2.x, while adding the ability to buy new levels for users on iPhone OS 3.x. Or have a note-taking app that sends notes via the built-in Mail client on iPhone 2.x, and uses the Mail Composer Window within your application when it's running on iPhone 3.x. Just be sure to clearly identify any version-specific features of your app in your marketing description.

The MailComposer sample code demonstrates this technique of targeting older OS versions while building with newly released APIs, using the mail compose view (from the MessageUI framework) as an example.

For more information on weak linking in Xcode, see the SDK Compatibility Guide.