0

I am trying to show ads on app. But it is not working (on Simulator + devices). error deatils : Error: Unable to show ads. Error: The operation couldn’t be completed. Ad was unloaded from this banner

-(void)viewDidLoad {
[super viewDidLoad];
self.adBanner.delegate = self;
self.adBanner.alpha = 0.0;

}

-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView animateWithDuration:0.5 animations:^ {
    self.adBanner.alpha = 1.0;
}];

}

-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
NSLog(@"Ad Banner action is about to begin.");
self.pauseTimeCounting = YES;
return YES;

}

-(void)bannerViewActionDidFinish:(ADBannerView *)banner {
NSLog(@"Ad Banner action did finish");
self.pauseTimeCounting = NO;

}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
NSLog(@"Unable to show ads. Error: %@", [error localizedDescription]);
// Hide the ad banner.
[UIView animateWithDuration:0.5 animations:^ {
    self.adBanner.alpha = 0.0;
}];

}

Ravi
  • 800
  • 2
  • 12
  • 28

1 Answers1

0

The adBanner is unloaded from the view when there are no ads to show.

Go to the iAd dashboard, follow the instruction and enable some ads for your App. (if you have not got developer role in apple member center then contact developer to set the ads for your app.)

your last delegate method

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error

gets called because it does not find the Ads.

Note - Test on devices for ads not on the simulator.

Vin
  • 456
  • 6
  • 18