Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'd like to use some features of iPhone OS 3.0 in my 2.0 app when it runs on a 3.0 device. I don't want to go 3.0 all the way because there are customers who do not want to update yet.

I experimented a bit with weak linking of the MapKit.framework (-weak_framework MapKit). I found it quite cumbersome, since I had to trick the compiler/linker to use the 2.0 SDK with all code except the one which uses MapKit.

Has anybody more experience with this? What are you doing to make it compile/link. Has anybody already submitted an app to Apple, which weak-links frameworks from other OS versions?

like image 254
Nikolai Ruhe Avatar asked Jun 12 '09 13:06

Nikolai Ruhe


1 Answers

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.

like image 174
David Maymudes Avatar answered Sep 20 '22 13:09

David Maymudes