插页式广告:收到请求错误:无广告展示

时间:2019-08-29 11:54:29

标签: ios swift admob googlemobileads gadinterstitial

嗨,我正在使用以下代码将插页式广告添加到我的应用中。我无法在设备上获得实时广告。我总是会收到此错误。我的应用程序也已启用,并且已将其与admob帐户关联。但仍然无法在该应用上投放广告。要在该应用上投放实时广告,例如admob上的中介广告组,我还需要做其他事情吗?

要创建和加载请求,请使用以下代码和

func createAndLoadInterstitial() -> GADInterstitial {
        let interstitial = GADInterstitial(adUnitID: interstitialAdUnit )
        interstitial.delegate = self
        let request = GADRequest()
        request.testDevices = [ kGADSimulatorID];
        interstitial.load(request)
        return interstitial
    }

当我需要致电广告时,我会使用此代码

                if !self.interstitial.hasBeenUsed {
                    if interstitial.isReady {
                        interstitial.present(fromRootViewController: self)
                    }else{
                        self.interstitial = self.createAndLoadInterstitial()
                    }
                }

下面是委托方法的代码

    func interstitialDidDismissScreen(_ ad: GADInterstitial) {
        self.interstitial = createAndLoadInterstitial()
    }


    func interstitial(_ ad: GADInterstitial, didFailToReceiveAdWithError error: GADRequestError) {
        self.showalertview(messagestring: error.localizedDescription, Buttonmessage: "ok") {
        }
    }

感谢您的帮助。 TIA

0 个答案:

没有答案