Reputation: 1878
I have implemented iAd in my iPhone application. I am using storyboard and have two viewControllers. I have implemented an AdBannerView in both viewControllers and have set the delegate to self. I have imported the and implemented the AdBanner delegate . I have also implemented the two methods -(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
and -(void)bannerViewDidLoadAd:(ADBannerView *)banner
which hides and shows the adView depending on if there are any ads available. But when I run the app and switches back and forth between the two viewControllers about 10 times I get this printed in logger in Xcode. I also set the adView = nil
in the -(void)viewDidDisappear:(BOOL)animated
method
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.
What does this mean? Have I done something wrong when I implemented iAd? Does this mean my app will be rejected by Apple?
SOLVED:
[adView removeFromSuperview];
in the -(void)viewDidDisappear:(BOOL)animated
method did it!
Upvotes: 0
Views: 1155
Reputation: 8053
try this, I think your problem solve
- (void) viewWillDisappear:(BOOL)animated
{
[_adView removeFromSuperview];
_adView.delegate = nil;
_adView = nil;
}
Upvotes: 2
Reputation: 25687
As the error states, you have more than 10 banner views in your app. Usually this occurs because of improper handling of the ads in a navigation controller scenario. You need to use a singleton instance of the banner view.
Google uibannerview single instance
.
Upvotes: 0