IAd banner shows test ad on simulator but not on device

I am trying to place an iAd banner in my application for iPhone. Here I declare a banner ad:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1]; [banner setAlpha:1]; [UIView commitAnimations]; } - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1]; [banner setAlpha:0]; [UIView commitAnimations]; } 

When I test the simulator, a test ad appears immediately. When I test my device nothing appears.

I recently signed up for the Apple iAd system, but when I try to look in the iTunes Connect iAd section, it tells me that the iAd network is currently unavailable. Therefore, the test ad will not appear on my device? If so, why is it still appearing on the simulator?

0
source share
2 answers

This is due to the fact that before the ads can be displayed, your device must contact the iAD servers, the search has thrown tens (if not hundreds) of thousands of ads, decide which one is best for your application, send the ad information to the device ios, and then send the confirmation back to the iAD server, and none of this can be done without a good Internet connection.

However, none of this should happen on the ios simulator , and the simulator simply displays a test ad no matter what.

I have two applications in the application store that use the same code as you, and display ads with the delay that you described. Thus, there are no errors with your code, and the delay for showing ads is completely normal.

So, as you can see, many things must happen before the iAD can be displayed on a real ios device, and even then you should have a strong internet connection

0
source

I hope this can be useful for new users, this works for me:

In ViewController.h

  @interface ViewController : UIViewController <ADBannerViewDelegate> { } @property (nonatomic, strong) ADBannerView *banner; @end 

And in ViewController

 - (void)viewDidLoad{ [super viewDidLoad]; //self.canDisplayBannerAds = YES; This give me a error self.banner = [[ADBannerView alloc] initWithFrame:CGRectZero]; self.banner.delegate = self; [self.banner sizeToFit]; self.banner.hidden = true; } 

And the last one:

Perform two methods:

 - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{ if (banner.isBannerLoaded) { [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; // Assumes the banner view is placed at the bottom of the screen. banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height); [UIView commitAnimations]; } } - (void)bannerViewDidLoadAd:(ADBannerView *)banner{ NSLog(@"Showing iAd"); self.banner.hidden = false; ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 50, 320, 50)]; //adView.delegate = self; [self.view addSubview:adView]; } 
0
source

All Articles