14
votes

I have followed the tutorial provided by Google here: https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start in order to setup admob banner ads.

My code is exactly how it is shown in the guide from the link above, so when I run the app on my test device or simulator a 'Smart Banner' 'Test Ad' appears..however, the second I remove the line of code below no banner appears at all..

 request.testDevices = @[ @"70b9ee4e66c8e6fa26cb84def25706d9" ];

Also, I've loaded the app on another device and still there is no ad banner appearing, which makes me wonder when I submit the app to the App Store it only makes sense that all my users won't be seeing ads on their devices. Why is this happening? I've been scratching my head on this one! I don't want to submit it for review until I am certain everything is working correctly and I know that ads will appear not only on test devices but when the app goes LIVE as well. Thanks in advance! :)

10
can you share your code? I just added admob to my app. You can create id from admob site and check this out if real ad is appearing on your bannerView.Yucel Bayram

10 Answers

5
votes
-(void)adViewDidReceiveAd:(GADBannerView *)bannerView;
-(void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(GADRequestError *)error;

There can be number of reasons for not showing the Live ads.

  1. Check your google admob account for the payment info. If not filled, fill it.
  2. Check if your device is registered as test device, else you may get suspension from the google for 30 days or so.
  3. You can check the delegate methods and print the logs:

In my case, I was getting error as { 'error': 'Request Error: No ad to show.', 'adType':'banner' }

But it showed at the client side, after I delivered to the client. So, I think that this issue was due to the reason that google had no advertisements in my region.

4
votes

If you are working with iOS10, you should add this to your .plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsForMedia</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

Only test ads will appear otherwise. You can find more details about it at Firebase's Admob documentation.

3
votes

Weird solution but it worked:

By following the guide provided by Google to setup Ad Mediation in iOS, it tells you to implememnt it via Storyboard/nib. Once I removed this method and simply implemented the GADBannerView programmatically, everything began to work as expected. Quite the annoying issue, but thankfully it's solved and I can move on.

2
votes

This not appear if will come up if you have limited ad tracking in your settings. On your device, check that Limit Ad Tracking is not enabled:

Settings -> Privacy -> Advertising

1
votes

I had this same issue.

My mistake was that I had created an app within AdMob for my Android application, which works great, however when it came to creating the app in iOS, all I did was create another ad unit under that same application. Doing that, gave me the same results that you are seeing.

To fix it, I created a new application inside AdMob that was for iOS platform, created an ad unit inside there and it solved my problem, I am now seeing real ads inside my app.

0
votes

Have you registered an account with AdMob? If so, have you replaced the test Ad Unit ID that's included in the quick start with your own? If not, that would explain the behavior you're seeing (the ID in the example is only for test ads, and won't serve real ones).

An Ad Unit ID identifies an ad placement within your app, and is unique to you. The AdMob instructions for generating one are in their help documentation.

0
votes

In my case it was actually due to the fact I was not using the correct ad unit ID (the part after the slash). I was able to find out as I used the sample IDs google provided, then I went to my admob account, click on the banner ad, I realized the two numbers for the plist (or initial setup in the app in app delegate) and for the ad unit are different. I spent probably hours on it :-(

0
votes

I had the following error returned: "The ad request was successful, but no ad was returned due to lack of ad inventory." This can also explain why ads won't show up.

-1
votes

HERE'S A SOLUTION IF SOMEONE ELSE STILL LOOKING FOR IT.

bannerView = GADBannerView();

GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = 
["YOUR DEVICE ID" ]
        bannerView.adUnitID = "YOUR ADMOB ID"
        bannerView.frame = CGRect(x: 0, y: screenHeight * 0.25, width: screenWidth, height: screenWidth * 0.2) // you can customise this
        bannerView.rootViewController = self
        let request = GADRequest()
        bannerView.load(request)
        self.view.addSubview(bannerView);
-2
votes

You registered your account in google admob account that I believed. You got your own test Id for your registered account. Follow the exact procedures and check the "self.bannerView.adUnitID" and also check the code "self.bannerView.rootViewController = self;" in objectice-c programming what you followed in your code. Most important thing is to check the correct banner size which is default size. Wishes for your success result. Enjoy coding..