views:

84

answers:

1

I created a universal app for the iPhone-iPad. I'm only working on the iPhone part at the moment. In the header file for the view controller for the iPhone one, I import the adbanner header and create an adbannerview variable with a matching property. I don't make it in the nib file but rather check at run time if the class exists, if it does, I create an adbanner programmily and then attach the adbannerview variable to it so I can refer to it inside other functions. Everything works on the 4.0 simulator. I also weak linked the iad class.

So if I take the same code to an earlier version of xcode and try to run using the 3.0 sim, it gives all these errors saying I can't import the header and make the adbannerview variable and the property, how do I get around this?

Thanks. If you need more details or my code, just ask.

+1  A: 

The AdLib Framework and iAds are only available in iOS > 4.0. For example, see the docs for ADBannerView:

Availability Available in iOS 4.0 and later.

If you are trying to build the app on an older version of the sdk (not just run the binary on a older device) and are getting errors when you try to import the headers like your question suggests, you could try wrapping the imports that fail in a #ifdef directive that tests for the availability macros from Availability.h, something like:

#ifdef __IPHONE_4_0
  // iOS 4 specific imports here
#endif
Jason Jenkins
Yes, so how would I do a check to make it so the iAd does not show when on earlier firmwares?
SolidSnake4444
I believe this is it. The sim gives me an error saying it can not find the iad framework but that is most likely due to the fact it's an older xcode. It compiles now with only this one error so once I get a 3.0 device I'm sure it should work, hopefully. I weak linked the iAd framework. Thanks for the help.
SolidSnake4444
If you still check out this question, what if someone has 4.0.2, what would happen with that code?
SolidSnake4444