AdMob插页式广告错误“请求错误:无广告显示”

我正在开发一个使用Swift2和Xcode7的iOS应用程序。 我正在尝试实施AdMob,但没有显示我的插页式广告。

override func viewDidLoad() { super.viewDidLoad() _interstitial = createAndLoadInterstitial() } func createAndLoadInterstitial()->GADInterstitial { let interstitial = GADInterstitial(adUnitID: "interstitial_ID") let gadRequest:GADRequest = GADRequest() gadRequest.testDevices = ["test device id"] interstitial.delegate = self interstitial?.loadRequest(gadRequest) return interstitial! } func interstitialDidReceiveAd(ad: GADInterstitial!) { _interstitial?.presentFromRootViewController(self) } func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) { print(error.localizedDescription) } func interstitialDidDismissScreen(ad: GADInterstitial!) { _interstitial = createAndLoadInterstitial() } 

我收到这个错误:

请求错误:无广告显示。

在这里输入图像说明

Request Error: No ad to show.

意味着您的请求已成功完成,但Admob目前没有广告显示您的设备。 确保始终有广告展示的最佳方式是使用中介,以便未完成的请求进入另一个广告networking。 Admob提供了很好的机制来做到这一点。

您应该有两个广告单元ID。 一个用于您的GADBannerView ,一个用于您的GADInterstitial 。 确保AdMob为您的插页式广告提供的广告单元ID与他们提供的完全相同 。 更新到最新的AdMob SDK ,目前7.5.0。 还要考虑以特定的时间间隔或者一旦用户完成所需的操作,调用presentFromRootViewController(self) 。 您现在设置的方式将会不断提交插页式广告,因为您每次发送新的插页式广告时都会发送请求,并在收到广告后立即显示插页式广告。

 import UIKit import GoogleMobileAds class ViewController: UIViewController, GADInterstitialDelegate { var myInterstitial : GADInterstitial? override func viewDidLoad() { super.viewDidLoad() myInterstitial = createAndLoadInterstitial() } func createAndLoadInterstitial()->GADInterstitial { let interstitial = GADInterstitial(adUnitID: "Your Ad Unit ID") interstitial.delegate = self interstitial?.loadRequest(GADRequest()) return interstitial } @IBAction func someButton(sender: AnyObject) { myInterstitial?.presentFromRootViewController(self) } func interstitialDidReceiveAd(ad: GADInterstitial!) { print("interstitialDidReceiveAd") } func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) { print(error.localizedDescription) } func interstitialDidDismissScreen(ad: GADInterstitial!) { print("interstitialDidDismissScreen") myInterstitial = createAndLoadInterstitial() }