Admob:插页式没有准备出席,为什么? (迅速)

时间:2017-06-13 18:16:07

标签: ios swift admob

我正在使用AdMob创建应用,事情是:该应用成功加载广告,但在尝试展示广告时,似乎广告尚未加载。我已按照Google AdMob上的指南进行操作......

这是我的viewDidLoad()

中的内容
interstitial = GADInterstitial(adUnitID: "ca-app-pub-45863574112xxxxxxxxxx/xxxxxxx")
    let request = GADRequest()
    interstitial.load(request)

这就是我点击按钮时调用的地方:

if self.interstitial.isReady {
            self.interstitial.present(fromRootViewController: self)
        } else {
            let alert = UIAlertController(title: "Couldn't load ad", message: "There was a problem while loading the ad... Still, thank you for wanting to support me :)", preferredStyle: .alert)
            alert.addAction(UIAlertAction(title: "Ok...", style: .cancel, handler: nil))
            self.present(alert, animated: true)
        }

好吧,我收到警报......你能告诉我原因吗?

1 个答案:

答案 0 :(得分:2)

您可以通过实施委托方法https://developers.google.com/admob/ios/api/reference/Protocols/GADInterstitialDelegate

告诉自己原因:)

具体optional func interstitial(_ ad: GADInterstitial!, didFailToReceiveAdWithError error: Any!)