目标c-Iad警告:超过10个ADBannerView实例 [英] Objective c - Iad WARNING: More than 10 instances of ADBannerView

查看:58
本文介绍了目标c-Iad警告:超过10个ADBannerView实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个标签栏应用程序. 像标题一样,我在屏幕底部也有一个iad横幅. 我已经实现了此方法来创建/销毁横幅并测试iad是否正常工作:

i have developed a tab bar application. Like title i have an iad banner positioned at bottom of screen. I have implemented this method to create/destroy banner and test iad works correctly:

创建:

-(void)viewWillAppear:(BOOL)animated {
     if(!adView) {
        adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 315, 310, 45)];
        adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
        adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
        adView.delegate = self;
        [self.view addSubview:adView];
    }

销毁:

    - (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    // iAd
    if (adView != nil) {
        adView.delegate = nil;
        adView.hidden = YES;
        adView = nil;
       [adView release];
    }  
}

但是,如果我尝试从选项卡栏快速更改视图,则会收到此错误:

But if i try to rapid change view from tab bar i receive this error:

警告:超过10个ADBannerView或ADInterstitialView实例 目前存在.这是iAd API和广告效果的误用 结果会受苦.此消息仅打印一次.

WARNING: More than 10 instances of ADBannerView or ADInterstitialView currently exist. This is a misuse of the iAd API, and ad performance will suffer as a result. This message is printed only once.

但是总是调用create和destroy方法.我可以做些什么来调试此警告问题? 非常感谢.

But the method create and destroy are always called. What i can do to debug this warning problem? Thanks so much.

推荐答案

您需要先将实例变量释放为零,然后再释放.

You need to release your instance variable before you nil it, not the other way around.

adView = nil;
[adView release];

应该是:

[adView release];
adView = nil;

这篇关于目标c-Iad警告:超过10个ADBannerView实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆