0

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!

Peter
  • 1,848
  • 4
  • 26
  • 44
  • did u remove ADBannerView when navigate to another ViewController ?? – Bhavin_m Mar 28 '13 at 13:18
  • 1
    Check that you're only creating one instance of the iAd view when your view loads, and only hiding and showing it in those delegate methods, not removing and recreating... – jjv360 Mar 28 '13 at 13:26
  • Developer.iOS I have set the adView = nil is the viewDidUnload method if that was what you ment? – Peter Mar 28 '13 at 13:54
  • jjv360 What do you mean by that? I'm I getting the whole concept of implementing iAd in the different viewControllers? should I do it another way? – Peter Mar 28 '13 at 13:56

2 Answers2

2

try this, I think your problem solve

- (void) viewWillDisappear:(BOOL)animated 
{
[_adView removeFromSuperview];
_adView.delegate = nil;
_adView = nil;
}
Deepesh
  • 8,065
  • 3
  • 28
  • 45
0

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.

Undo
  • 25,519
  • 37
  • 106
  • 129