问题
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:
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. This is a misuse of the iAd API, and ad performance will suffer as a result. This message is printed only once.
But the method create and destroy are always called. What i can do to debug this warning problem? Thanks so much.
回答1:
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;
来源:https://stackoverflow.com/questions/12669989/objective-c-iad-warning-more-than-10-instances-of-adbannerview