With iOS 4 comes 1500 new features for developers to take advantage of. Unfortunately, not all of your users will be able to enjoy this new experience. For example, if your user has a 1st generation device only capable of running OS 3.1. Or an iPad which (at the time of writing this article) only runs 3.2. Utilizing some of these new features will make or break a cross version app, but some can be worked with. This tutorial demonstrates how to solve this problem.
Let’s use iAds as an example. Apple announced that iAds will only available on iOS 4 which at the moment leaves the iPad, iPhone 1G, and iPod Touch 1G users unable to use an app with iAds unless you change a few things in your build. Simply adding the iAd framework to your project will break a 3.1 build. But there is a way around it all allowing you to deploy to practically everybody except those refusing to move on from iPhone OS 2.x. The solution is weak linking your frameworks, and here is how to do it.
In Xcode, expand your targets and right click (or ctrl-click) on your target. Select “Get Info” from the popup menu.
Under the “General” tab, find the iOS 4 framework you would like to weak link and click “Required.” In the popup menu that appears, select “Weak” and close the window, recompile, run, voila!
- Beginner Action Game Tutorial
- More hunts from last year
- Bombs with Box2D & Cocos2D
- TableView & Navigation Source
- iAd, more truth revealed
If you found this useful, shoot me a small donation or at the very least leave a comment, every bit of encouragement helps keep me motivated to update with more content on a regular basis!