iPhone 3.0 with backward compatibility–step by step

Developer Forums Beta: 3.0 with backward compatibility–step by step (UPDATE: I think this link is dead.)

These steps in the post above will help you run a 3.0 compiled app on a 2.x device.

UPDATE: Given that the link above is dead (apparently) here’s some other/more info:

Apple has some Sample code that does it.

Basically you weak link the framework (e.g., StoreKit).

Then you instantiate the classes by name (e.g., Class mailClass = (NSClassFromString(@”MFMailComposeViewController”));).

Then if the the object isn’t nil, you can call methods on it. Or call them performSelector.

To make the framework a weak-link, go to your ->Get Info and click on the General tab. The frameworks will specify the Required/Weak:

Weak-Link Framework

There are plenty of posts about conditional compiles and run-time checks:

Cross-Platform Development

respondsToSelect checks

OS Version checkhink