我想在我的快速应用中展示一个奖励广告(Google AdMob)。(XCode 11.4,Swift 5,Storyboard),但是每当我加载广告时,它都会在控制台中显示以下错误消息:
Error Domain=com.google.admob Code=5
"Request Error: The Google Ad request was unable to be fulfilled before a timeout occurred."
UserInfo={NSLocalizedDescription=Request Error: The Google Ad request was unable to be fulfilled before a timeout occurred., gad_response_info=<GADResponseInfo: 0x6000030f8090>}
我基本上遵循了谷歌AdMob教程的教程。
info.plist
中func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GADMobileAds.sharedInstance().start(completionHandler: nil)
}
这就是它失败的地方:
override func viewDidLoad() {
super.viewDidLoad()
rewardedAd = GADRewardedAd(adUnitID: adId)
rewardedAd?.load(GADRequest()) { error in
if let error = error {
print("Error while loading ad: \(error.description)")
// Timeout occurs here!!!
} else {
if self.rewardedAd?.isReady == true {
self.rewardedAd?.present(fromRootViewController: self, delegate:self)
}
}
}
}
知道我为什么要暂停吗?
注意:
Error while loading ad: Error Domain=com.google.admob Code=1
"Request Error: No ad to show."
UserInfo={NSLocalizedDescription=Request Error: No ad to show., gad_response_info=<GADResponseInfo: 0x6000018f4d80>}
我在“info.plist”:ca-app-pub-3940256099942544~1458002511
和AdID:ca-app-pub-3940256099942544/1712485313
中都使用过,它们都来自上面提到的谷歌教程页面。
发布于 2020-05-10 15:11:02
我认为你应该使用你自己的appID和测试广告ID。
https://stackoverflow.com/questions/61597394
复制相似问题