Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob bannerView Request Error: No ad to show

I'm having this issue on one of my ads for an ios game

Here is my code, the odd thing is that if I add the device on the request.testDevices list it displays the demo banner, if I remove from testDevices, it does not show a real banner, but if I change my bundleIdentifier on XCODE, it shows a real banner,so I believe its something with my admob account, does anyone ever got something like it?

Its always failing with this error:

AdView didFailToReceiveAdWithError --------------------------- : Error Domain=com.google.ads Code=1 "Request Error: No ad to show." UserInfo={NSLocalizedDescription=Request Error: No ad to show., NSLocalizedFailureReason=Request Error: No ad to show.}

On my AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {      // Use Firebase library to configure APIs     [FIRApp configure];     [[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:YES];     // Initialize Google Mobile Ads SDK     [GADMobileAds configureWithApplicationID:@"ca-app-pub-xx~xx"];     /* other stuff here... */  } 

on my rootViewController.m

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad {     [super viewDidLoad];     bannerViewAdded = NO;     interstitialViewAdded = NO;     [self addBanner];    // ..... more stuff here;  }  - (void)addBanner{      NSLog(@"CALL ADD BANNER ROOTVIEWCONTROLLER");      if(!bannerViewAdded && ![MKStoreManager isFeaturePurchased:kFeatureAId]){      NSLog(@"ADD BANNER ROOTVIEWCONTROLLER");     CGSize size = [[CCDirector sharedDirector] winSize];       // Create adMob ad View (note the use of various macros to detect device)     if (IS_IPAD || IS_IPADHD) {         bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeLeaderboard];         bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);     }     else if (IS_IPHONE6) {         bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];         bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);     }     else if (IS_IPHONE6P) {         bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];         bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);     }     else {         // boring old iPhones and iPod touches         bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];         bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);     }      //[bannerView setBackgroundColor:[UIColor blueColor]];      // Need to set this to no since we're creating this custom view.     //bannerView.translatesAutoresizingMaskIntoConstraints = NO;      // Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID     // before compiling.      // Replace this ad unit ID with your own ad unit ID.     bannerView.adUnitID = @"ca-app-pub-xx/xx";     bannerView.rootViewController = self;     bannerView.delegate = self;     [self.view addSubview:bannerView];       GADRequest *request = [GADRequest request];     //request.testDevices = @[ kGADSimulatorID ];     //request.testDevices = @[  @"xx", @"xx"  , kGADSimulatorID ];      [bannerView loadRequest:request];     bannerViewAdded = YES;     }  }  - (void)removeBanner {   //admob   if(bannerViewAdded){       bannerViewAdded = NO;       [bannerView removeFromSuperview];       [bannerView release];       bannerView = nil;   }   //No AdMOB   if(localBannerAdded){       localBannerAdded = NO;       [localBannerButton removeFromSuperview];       [localBannerButton release];       localBannerButton = nil;   } }   - (void)addInterstitial{      if(!interstitialViewAdded && ![MKStoreManager isFeaturePurchased:kFeatureAId]){         NSLog(@"INIT INTERSTITIAL ROOTVIEWCONTROLLER");         interstitialView =  [[GADInterstitial  alloc] initWithAdUnitID:@"ca-app-pub-xx/xx"];          GADRequest *request = [GADRequest request];         // Requests test ads on devices you specify. Your test device ID is printed to the console when         // an ad request is made. GADBannerView automatically returns test ads when running on a         // simulator.         //request.testDevices = @[ kGADSimulatorID, @"xxx", @"xxx" ];         [interstitialView loadRequest:request];         [interstitialView setDelegate:self];      }  }  - (void)adView:(GADBannerView *)gadBannerView didFailToReceiveAdWithError:(GADRequestError *)error{     NSLog(@"AdView didFailToReceiveAdWithError --------------------------- : %@",  error);     [self removeBanner];     if(!localBannerAdded){         CGSize size = [[CCDirector sharedDirector] winSize];         localBannerButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];         localBannerButton.frame = CGRectMake(0.0, 0.0, 320.0, 50.0);         [localBannerButton setTitle:@"DOWNLOAD MORE FREE GAMES" forState:UIControlStateNormal];         localBannerButton.backgroundColor = [UIColor whiteColor];//[UIColor clearColor];         [localBannerButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal ];         [self.view addSubview:localBannerButton];          [localBannerButton setCenter:CGPointMake(self.view.center.x,(size.height-CGRectGetHeight(localBannerButton.frame)/2)-2)];          // Add Target-Action Pair         [localBannerButton addTarget:self action:@selector(openAppStore:) forControlEvents:UIControlEventTouchUpInside];         localBannerAdded = YES;     }  } 
like image 820
Gil Beyruth Avatar asked Aug 23 '16 18:08

Gil Beyruth


People also ask

Why is my AdMob app not displaying ads?

Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.

How long does it take for AdMob to show ads?

How long does it take for ads to begin appearing after the first ad request? When apps are newly registered with AdMob, it typically takes up to an hour and a few ad requests to allow inventory to build. Because of this, you may not see live impressions immediately. Note: In some cases, it may take longer than an hour.

How do I fix error code 3 on AdMob?

Google throws error code 3 for many reasons. One of the official reason is that there is no Ads in the Google Server. This Error is also caused when you change your Keystore after implementing the Ad to previous Keystore. If you have changed your Keystore then you can fix this error just by replacing the Ad Unit.


1 Answers

I just had this error today, the problem for me was simple, it was because the adUnitID is basically still new. I had to wait more than 2 hours after creating the adUnitID in order for the ads to be served.

If you have this error, and some of your adUnitIDs serve ads and some don't. You're highly likely having the same issue, and the only way to fix it is to wait.

like image 54
Ibrahim Avatar answered Sep 22 '22 01:09

Ibrahim