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];
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With