简体   繁体   中英

AdMob banner shows in Simulator but not on device/TestFlight

I'm using AdMob for banner ads in an app. The banner ads show up on the Simulator but not when I run it on an iPhone device via connected cord or TestFlight.

This is my code for running it on a real device:

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

Am I missing something?

I've tried to look at other questions but nothing has worked for me yet that has been suggested.

Thanks!

First of all, do you running the debug or the release version? If you run your app in the debug mode, add the device id (you can find it in the console) to the testDevices array:

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

Read more about test ads in AdMob Documentation

And the second thing you should consider, that AdMob may not provide enough fill rate for your ads. Especially if the app is new, it can take some time while traffic will be analysed, before the service will provide your some ads. Consider this, if your testing your app in release mode.

Perhaps try checking your iPhone Settings to see if Limit Ad Tracking is turned on? (Settings/Privacy/Advertising).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM