简体   繁体   English

目标c-Iad警告:超过10个ADBannerView实例

[英]Objective c - Iad WARNING: More than 10 instances of ADBannerView

i have developed a tab bar application. 我已经开发了标签栏应用程序。 Like title i have an iad banner positioned at bottom of screen. 像标题一样,我在屏幕底部也有一个iad横幅。 I have implemented this method to create/destroy banner and test iad works correctly: 我已实现此方法来创建/销毁横幅并测试iad是否正常工作:

Create: 创造:

-(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];
    }

Destroy: 破坏:

    - (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: 但是,如果我尝试从选项卡栏快速更改视图,则会收到此错误:

WARNING: More than 10 instances of ADBannerView or ADInterstitialView currently exist. 警告:当前存在10个以上的ADBannerView或ADInterstitialView实例。 This is a misuse of the iAd API, and ad performance will suffer as a result. 这是对iAd API的滥用,因此会降低广告效果。 This message is printed only once. 该消息仅打印一次。

But the method create and destroy are always called. 但是总是会调用create和destroy方法。 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];

Should be: 应该:

[adView release];
adView = nil;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM