How to add iAd to iPad

I’m working on a universal application and I want to add an ad banner to it, iAd works fine on iPhone , but how to control it for iPad .

Since the latest version of iPad supports iAd , but in a different size format and gives an error in my Builder interface when I am targeting iPad 3.2 .

+4
source share
1 answer

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) { //iAd is present } 

Hope this helps

+3
source

Source: https://habr.com/ru/post/1346681/


All Articles