views:

3520

answers:

2

With iOS4 coming out soon, I have already planned to include an iAd in a future update of an app of mine. I assume that this will make my app unusable for anyone on a firmware lower than 4.0. Is there a way to change that variables and the .xib file based on the user's firmware? Cheers.

+29  A: 

Yes, you can build with 4.0 SDK and still run on devices with earlier versions of the firmware.

  • Set your Deployment Target to the earliest version you want to be able to run with, ie: 3.0.
  • You set your Base SDK to the latest version that you are compiling with, ie: 4.0. This way you can reference the newer definitions and symbols in your code. This article "SDK and Deployment Targets" discusses Deployment vs Base SDK in detail.
  • Weak link to the libraries/frameworks with symbols that are only available in the newer iOS. This is so your app will run on a device that doesn't have the newer symbols.
  • You must check to see that a newer method is available before calling it. You have to make sure not to call a method that is 4.0 only when your app is on a < 4.0 device. Of course you have to gracefully handle working on older versions by either using older methods or not supporting particular features that need newer SDK support.

See these SO questions and answers for more details:

progrmr
So what happens to the iAd delegate's methods?? Will they fire an error?
Red Serpent
Yes, they would error. You can't display iAd's on anything lower than iOS 4. You would need to do some kind of conditional ifdef checking so that iAd's aren't attempting to be shown on iOS 3.x
JonB
A: 

I am getting stuck with this! If I install SDK 4 on my machine I lose all targets prior to 3.2?

I have then followed advice re install SDK's in different folders but now as I have IOS4 on my iPhone I have to keep bouncing between SDKs?

What do I need to do to get all targets prior to 3.2 visible in SDK 4?

Thanks

user7865437
This should not be an answer, but a new question by itself.
Brad Larson