Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get any test ad using AdMob on ios

Tags:

ios

admob

I'm testing the AdMob. I do it like this:

AdManager *adManager = [AdManager sharedAdManager];
adManager.gadBannerView.adUnitID = @"a1514981c9444a4";
adManager.gadBannerView.rootViewController = self;
adManager.gadBannerView.delegate = self;
[adManager.gadBannerView setOriginY:self.view.frame.size.height-adManager.gadBannerView.frame.size.height];
[self.view addSubview:adManager.adBannerView];


GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:@"CECADC69-4A6B-4BB4-BF24-CACDA871B44A", nil];
[adManager.gadBannerView loadRequest:request];

And the @"CECAD..." the GAD_SIMULATOR_ID. I always get the error in the console when I'm testing on my simulator. Also same error when on my device. The iOS version is 6.0+. Even when I remove the request.testDevices = ..., I can't get any ad.

"Google": To get test ads on this device, call: request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];

like image 869
sunkehappy Avatar asked Mar 20 '13 15:03

sunkehappy


People also ask

Does Google AdMob work on iOS?

In future, if you already have an app on the App Store, you can let AdMob retrieve your app information. Set the app name to GoogleAdMobDemo and choose iOS for the platform option. Click Add to proceed to the next step. AdMob will then generate an App ID for the app.

Why is AdMob not showing ads in my app?

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.


2 Answers

The reason turn out to be I've not successfully loaded request and added the GADBannerView to my view hierarchy. And that log To get test ads on this device, call: request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil]; will always show. I think this should be tips to tell developer how to get test ads.

like image 153
sunkehappy Avatar answered Sep 28 '22 10:09

sunkehappy


Did you try

request.testing = YES;

Please note that you need to run in debug mode to get test ads. Actually I even do not use testDevices property and it works.

I think if you do not specify the test devices it get test ads on every devices, if you have compiled in debug mode.

like image 22
Mert Avatar answered Sep 28 '22 10:09

Mert