开发者

dismissModalViewController with iAds. A banner view has an ad but may be obscured

Heres my issue. I have a login screen which is shown using PresentModalViewAnimated. Once the user logins in it is dismissed.

On the login screen i have a iAd but when it is dismissed I get this error.

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

Also when I login then log back out, the iAd is not displayed again.

Snippets of my code

    @synthesize bannerIsVisible;

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    if (!self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        // banner is invisible now and moved out of the screen on 50 px
        banner.frame = CGRectOffset(banner.frame, 0, 50);
        [UIView commitAnimations];
        self.bannerIsVisible = YES;
    }
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    if (self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // banner is visible and we move it out of the screen, due to connection issue
        banner.frame = CGRectOffset(banner.frame, 0, -50);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
    NSLog(@"Banner view is beginning an ad action");
    BOOL shouldExecuteAction = YES;
    if (!willLeave && shouldExecuteAction)
    {
        // stop all interactive processes in the app
        // [video pause];
        // [a开发者_如何学JAVAudio pause];
    }
    return shouldExecuteAction;
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
    // resume everything you've stopped
    // [video resume];
    // [audio resume];
}


    - (void)viewDidLoad
{
    interestingTags = [[NSSet alloc] initWithObjects: INTERESTING_TAG_NAMES2]; //set interestingTag var to define
    self.userArray = [[NSMutableArray alloc] init]; //init the userArray

    adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    adView.frame = CGRectOffset(adView.frame, 0, -50);
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
    [self.view addSubview:adView];

    adView.delegate=self;
    self.bannerIsVisible=NO;

    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}


I think that with this you could to eliminate the error. Just removing the banner view in ViewWillDisappear:

-(void)viewWillDisappear:(BOOL)animated
{
    [bannerView removeFromSuperview];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜