AdMob banner shows in Simulator, but not on device / TestFlight

I am using AdMob for in-app banners. Banner ads appear on the Simulator, but not when I launch it on an iPhone via a plugged in cord or TestFlight.

This is my code to run it on a real device:

let request = GADRequest()
bannerView.adUnitID = realAdUnitID
bannerView.rootViewController = self
bannerView.delegate = self
bannerView.load(request)

      

Did I miss something?

I tried looking at other questions, but nothing worked for me, but it was suggested.

Thank!

+3


source to share


1 answer


First of all, are you using the debug or release version ? If you run the app in debug mode, add the device ID (you can find it in the console) to the array testDevices

:

let request = GADRequest()
request.testDevices = [kGADSimulatorID,  // All simulators
                       "2077ef9a63d2b398840261c8221a0c9b"];  // Sample device ID

      



Learn more about test ads in the AdMob documentation

And the second thing you should consider is that AdMob may not be delivering sufficient fill rate for your ads. Especially if the application is new, it may take a while for the traffic to be analyzed before the service provides you with some ads. Consider this if you are testing your application in release mode.

+4


source







All Articles