help with iAds

Discussion in 'iPhone/iPad Programming' started by cinek, Apr 29, 2011.

  1. cinek, Apr 29, 2011
    Last edited: Apr 29, 2011

    macrumors 6502

    Joined:
    Mar 12, 2011
    #1
    I'm trying to implement iAds in my first app. But I'm getting this error message: ADBannerView: WARNING A banner view (0x620a390) has an ad but may be obscured. This message is only printed once per banner view.



    the ad shows up for about a second or so, and dissapears. I have no idea what's wrong. I need it to display at the bottom of the screen. I have imported the framework & the iAd/iAd.h file in the header file. Here's the code I'm using:

    Code:
    
    @synthesize bannerIsVisible;
    
    -(void)bannerViewDidLoadAd:(ADBannerView *)banner {
    
        if(!self.bannerIsVisible){
    
            [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
    
            banner.frame = CGRectOffset(banner.frame, 0, 280);
    
            [UIView commitAnimations];
    
            self.bannerIsVisible = YES;
    
        }
    
    }
    
    -(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    
        if(self.bannerIsVisible){
    
            [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
    
            //banner is visible - move it out of the screen due to a connection issue
    
            banner.frame = CGRectOffset(banner.frame, 0, -280);
    
            [UIView commitAnimations];
    
            self.bannerIsVisible = NO;
    
        }
    
    }
    
    //from view did load
        banner = [[ADBannerView alloc] initWithFrame:CGRectZero];
    
         banner.frame = CGRectOffset(adView.frame, 0, -280);
    
         banner.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierLandscape];
    
        banner.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
    
        [self.view addSubview:banner];
    
        banner.delegate = self;
    
        self.bannerIsVisible = NO;
    
    
     
  2. macrumors regular

    Joined:
    Aug 26, 2010
    #2
    Take a look at the sample code for iAds. Sorry I don't have the link handy. It sounds like your not adjusting your other views properly.
     

Share This Page