15

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?

Peter Fortuin
  • 5,041
  • 8
  • 41
  • 69

8 Answers8

22

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 ;)

Chris Ladd
  • 2,795
  • 1
  • 29
  • 22
7

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;
}
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • Thanks. I was beginning to bang my head against the wall on this detail, but simply moving the _bannerView.hidden call outside the animation block did the trick! – Norman G Jun 04 '12 at 13:57
2

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
Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
  • I turned off autosizing on the AdBannerView in the XIB for every dimension except distance from the bottom (my banner's at the bottom of the screen, and there's a tab bar below it). This appears to have resolved it for me. – Oscar Jun 04 '12 at 02:04
1

The answer from LearnCocos2D was the solution for me. Not sure if this is a specific issue with Cocos2D (which I am using). My problem was I was using the "new" style animations using blocks which Apple recommends using, animateWithDuration:delay:options:animations:completion: When I use these, I get the obscured warning. I guess the problem is the view is partially obscured while it's animating in, hence the warning, but you can't make it completely visible before it's done animating, obviously, unless you just want to pop it on screen, which is ugly.

That's OK, because switching back to the "old" style animation using beginAnimations: and commitAnimations: did eliminate the warnings for me. I'm curious if this warning means you are actually missing out on ad revenue or if it's just annoying but not actually a problem.

Ben Stahl
  • 1,139
  • 11
  • 11
1

I got the same problem but the reason is I have OpenFeint notification bars on top of that, e.g. high scores, achievement unlocked, etc. It slides in and then slides out, does not stay for long, so I don't think it is a problem.

I you put ADS on the top, then user would not see OpenFeint notifications, that will be another problem, I do not know if this happens if you have ADS and OpenFeint on different locations of screen, I did not try it as my app's bottom screen is full of buttons, so only top of screen is available.

Hao Zhe XU
  • 11
  • 1
1

Another option is to listen for status bar resize events and move the iAd when that happens so that it isn't respositioned offscreen (resulting in that warning and no served Ads).

In your app delegate, tap into this function:

  • (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame // Check newStatusBarFrame.size.height and animate your iAd frame up or down accordingly.
David Neiss
  • 8,161
  • 2
  • 20
  • 21
1

I am obtaining this message when I add a ADBannerView to a UIScrollView. In this case the ad may be obscured.

Freeman
  • 5,810
  • 3
  • 47
  • 48
0

I had code like this:

if (animate)
{
    [UIView animateWithDuration:0.5 animations:^{
        self.adBannerView.frame = adBannerFrame;
        self.otherViewFrame.frame = otherViewFrame;
        }
     ];
}
else
{
    self.adBannerView.frame = adBannerFrame;
    self.otherViewFrame.frame = otherViewFrame;
}

and after some experimenting, I found that the order of the initializations should be reversed in both if and else legs.

    self.otherViewFrame.frame = otherViewFrame;
    self.adBannerView.frame = adBannerFrame;

So the idea was not to let another view cover the AdBannerView, even for a few microseconds.

Dko
  • 820
  • 6
  • 12