【发布时间】:2020-11-02 10:43:51
【问题描述】:
我正在使用 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()
}
我收到此错误:
请求错误:没有广告可展示。
【问题讨论】:
-
请求错误:没有可展示的广告,听起来 AdMob 无法满足您的广告请求。再试一次。您是否收到任何其他错误/警告?您使用的是哪个版本的 AdMob SDK?
-
@DanielStorm 我用 CocoaPods(pod 'Google-Mobile-Ads-SDK', '~> 7.0') 安装了 AdMob。我又试了一次,但只收到了那个错误。
-
但是 GADBannerView 正常显示...