Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a problem when an iAd may be obscured?

Tags:

iphone

ios4

iad

I added the ADBannerView to a view and when I load the app I get the following message:

ADBannerView: WARNING A banner view (0x7a023c0) has an ad but may be obscured. This message is only printed once per banner view.

As far as I can see the entire banner is visible on the screen. Is this really a problem? Or is it only a warning that I can ignore?

like image 939
Peter Fortuin Avatar asked Nov 11 '10 22:11

Peter Fortuin


3 Answers

As Stephen Darlington says, it's a good idea to figure out what the issue is. An easy way to double-check this in code (from a view controller) would be:

     // bring your bannerView to the front
   [self.view bringSubviewToFront:bannerView];

     // and make sure it's positioned onscreen.
    bannerView.frame = CGRectMake(0.0, 0.0, bannerView.frame.size.width, bannerView.frame.size.height);

Assuming you had an iVar / IBOutlet to your AdBannerView called bannerView, this would take care of any interface builder positioning issues, and make sure bannerView wasn't covered by anything.

From my experience, nothing bad happens if the ad is offscreen, however, the iAd will not load new ads until it knows it is fully onscreen. So, as you start up your app,

  1. Your AdBannerView will attempt to load an advertisement, whether it is onscreen or not.

  2. Depending on whether or not it is successful, your AdBannerViewDelegate will receive either

    a) bannerViewDidLoadAd: (proceed to step 3) or

    b) bannerView: didFailToReceiveAdWithError: (the AdBannerView will try again on its own)

  3. At that point, the ball is in your court as to what to do with said bannerView, if in fact it did load an ad. An easy way to check for this in code is yourBannerView.bannerLoaded, which will return YES if it has an ad, or NO if it doesn't. And so...

  4. How you handle the AdBannerView after it successfully loads its initial ad determines how it will behave in the future. You do not have to place it onscreen immediately -- choose a time that makes sense within your application. However, a banner view that has successfully loaded an ad will NOT try to load another one until it is onscreen. (Makes sense, right?) The tricky part is....

    4b) you also won't get any new delegate messages from that bannerView, so if you're not moving the bannerView onscreen immediately upon getting the bannerViewDidLoadAd delegate message, you'll have to implement some kind of control structure on your own to handle when, if at all, you DO move it onscreen, at which point it will begin asking the ad server for more ads, and you'll get more delegate messages, and the cycle begins anew.

So, to sum up: It's only a problem if your iAd is obscured if you'd like to serve more iAds and get paid. However, eCPM has been very, very low lately, so maybe that's not such an issue after all ;)

like image 119
Chris Ladd Avatar answered Sep 27 '22 19:09

Chris Ladd


To add to this discussion, I received this message when I modified the center property to move the ad just outside the screen. I use UIView animations to slide the ad onto the screen.

After some experimenting I figured out how to do this without causing the message to appear. The trick was to hide to set the adBannerView.hidden property to YES while waiting for the ad to load. Once it was loaded, I just had to make sure to set the hidden property to NO only after committing the animation:

-(void) fadeAdIn:(UIView*)view
{
    float offsetY = view.frame.size.height * (bannerOnBottom ? 1 : -1);

    CGPoint pos = [self getBannerPosition];
    view.center = CGPointMake(pos.x, pos.y + offsetY);

    [UIView beginAnimations:@"AdIn" context:nil];
    [UIView setAnimationDuration:1.0];
    view.center = pos;
    [UIView commitAnimations];

    // must unhide AFTER animation has been committed to prevent "ad obstructed"
    view.hidden = NO;
}
like image 32
LearnCocos2D Avatar answered Sep 27 '22 19:09

LearnCocos2D


Like compiler warnings, I think this is something that you should probably try to get to the bottom of even if it's not immediately causing problems. If I were Apple, I'd send my ads to apps that actually show them (I'm not saying they do do this), so there could be a financial aspect too.

A couple of problems that I've seen:

  • The iAd frame is slightly off, maybe off the screen by just a pixel or two
  • You've accidentally created two iAds and one is on-screen and the other is hidden behind the first
like image 36
Stephen Darlington Avatar answered Sep 27 '22 19:09

Stephen Darlington