Well, I haven't done it in my iPad apps yet, but here's how I would do it.
- First of all, I would point out the iAd framework as a weak / optional link. This will be the first step for compatibility with pre-iOS4. If you do not, the application may not even start
- Secondly, I would not add it to the nib file (if used). I would prefer to add it programmatically to be ale to check if the iAd infrastructure is available on the device.
- Lastly, check if iAd is present. If so, set up your ad, but if itβs not, just go ahead or install admob instead or something like that.
How to verify iAd is present? One easy way is to do something like this
if(NSClassFromString(@"ADBannerView") != nil) {
Hope this helps
source share