AdMob非页内广告没有显示出什么问题? [英] AdMob interstitial not showing What is wrong?

查看:70
本文介绍了AdMob非页内广告没有显示出什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向我的应用中添加admob插页式广告,但是当我运行我的应用时,没有任何广告显示。我只是在日志中收到一条消息,内容是:

I am trying to add admob interstitial ads to my app but when I run my app no ad shows up. I just get a message in the logs saying :

< Google>要在此设备上获取测试广告,请致电:request.testDevices = @ [@«设备ID»»;;

我很确定知道我由于先前的错误而试图显示添加项,但是它不会出现。

I'm pretty sure it knows im trying to show an add because of a previous error but it just won't appear.

这是我的代码(我在第一部分中添加了一条打印语句,但是似乎没有考虑到它):

here is my code( I added a print statement to the first part but it doesn't seem to take it into considiration ):

if interstitialad != nil {
            if interstitialad!.isReady {
                interstitialad?.present(fromRootViewController: self)

            }
        }

这是代码的第二部分(请注意,两者都在ViewDidLoad中)

here is the second part of the code ( note both are in ViewDidLoad )

if interstitialad != nil {
            if interstitialad!.isReady {
                interstitialad?.present(fromRootViewController: self)
            }
        }


        func createAndLoadInterstitial() -> GADInterstitial {
            let request = GADRequest()
            let interstitial = GADInterstitial(adUnitID: "unit id")
            //request.testDevices = ["iPhone test device ID"]
            //request.testDevices = ["simulator ID"]
            interstitial.delegate = self
            interstitial.load(request)
            return interstitial
        }
        interstitialad = createAndLoadInterstitial()

这有什么问题?
谢谢!

What is wrong with this? Thanks !

推荐答案

您说过您要展示您的 GADInterstitial 在您的 viewDidLoad 中。这不是您应该显示 GADInterstitial 的时候。您需要给 GADInterstitial 时间来加载广告。在您的 viewDidLoad 中展示广告也违反AdMob服务条款。您应该在应用程序的过渡/操作期间显示 GADInterstitial 。您还应该实现 GADInterstitial 委托方法,以便知道为什么广告加载失败,何时实际加载以及用户何时关闭广告,这样您才能继续即可在您的应用程序中进行转换。

You said you're trying to present your GADInterstitial in your viewDidLoad. This is not when you should be presenting your GADInterstitial. You need to give the GADInterstitial time to load the ad. Presenting an ad in your viewDidLoad is also against the AdMob TOS. You should be presenting the GADInterstitial during a transition/action in your application. You should also implement the GADInterstitial delegate methods so you know why the ad is failing to load, when it has actually loaded, and when the user has dismissed the ad so you can continue to transition them in your application.

GADInterstitial广告事件

这篇关于AdMob非页内广告没有显示出什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆