有时无法加载奖励视频广告
Unable to load rewarded video ads sometimes
我已经启动了一个 iOS 应用程序,但我在使用 Google 移动广告 SDK 加载奖励视频广告时遇到问题。
当玩家点击按钮观看视频广告时,播放器看到视频的次数很少。大多数时候,用户会看到 Admob 无法满足请求的错误:
Error Domain=com.google.ads Code=1 "Request Error: No ad to show."
有的时候要点好几下才能得到一个,有的时候就是点了多少次也得不到。这个问题更多地发生在我的奖励视频上,但它也发生在我的横幅广告上。有时 Google 无法向我提供横幅广告。有谁知道为什么这不起作用?
我的广告代码:
override func viewDidLoad() {
super.viewDidLoad()
if let view = self.view as! SKView? {
// Load the SKScene from 'GameScene.sks'
let scene = MainMenu(view.bounds.size, self, nil)
scene.scaleMode = .aspectFill
// Present the scene
view.presentScene(scene)
view.ignoresSiblingOrder = true
view.showsFPS = false
view.showsNodeCount = false
view.showsPhysics = false
GADRewardBasedVideoAd.sharedInstance().delegate = self
GADRewardBasedVideoAd.sharedInstance().load(getRequest(),
withAdUnitID: rewardAdId)
// In this case, we instantiate the banner with desired ad size.
if GameViewController.bannerView == nil {
GameViewController.bannerView = GADBannerView(adSize: kGADAdSizeBanner)
GameViewController.bannerView.adUnitID = bannerId
GameViewController.bannerView.rootViewController = self
GameViewController.bannerView.load(getRequest())
GameViewController.bannerView.isHidden = true
addBannerViewToView(GameViewController.bannerView)
}
authenticateLocalPlayer()
QuestManager().checkForRefresh()
}
}
public func getRequest() -> GADRequest {
let request = GADRequest()
return request
}
public func displayRewardedVideo() {
if GADRewardBasedVideoAd.sharedInstance().isReady {
GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: self)
} else {
GameViewController.loadVideo()
}
}
public static func loadVideo(){
if !GADRewardBasedVideoAd.sharedInstance().isReady {
GADRewardBasedVideoAd.sharedInstance().load(GADRequest(),
withAdUnitID: rewardAdId)
}
}
func rewardBasedVideoAdDidClose(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
GADRewardBasedVideoAd.sharedInstance().load(getRequest(),
withAdUnitID: rewardAdId)
if let scene = gameScene {
scene.audioManager.unmmute()
}
print("Video did close")
}
我目前在一家提供大量免费移动应用程序的公司工作,作为自由职业者使用 Admob,所以我非常熟悉它。
无论如何,我从我公司的经理那里了解到(他们那里也有一位 Google Admob 顾问),应用程序中显示的广告可能取决于所在国家/地区用户在。例如,我在东南亚,而他们在欧洲。我遇到过一些时候我没有收到横幅广告,但他们总是收到各种类型的广告。
只要您的项目符合 Google Admob 的规则(例如,不要在短时间内展示插页式广告),而且你至少每隔一段时间收到一次广告,那么我相信你做的很好。
希望对您有所帮助。
我已经启动了一个 iOS 应用程序,但我在使用 Google 移动广告 SDK 加载奖励视频广告时遇到问题。
当玩家点击按钮观看视频广告时,播放器看到视频的次数很少。大多数时候,用户会看到 Admob 无法满足请求的错误:
Error Domain=com.google.ads Code=1 "Request Error: No ad to show."
有的时候要点好几下才能得到一个,有的时候就是点了多少次也得不到。这个问题更多地发生在我的奖励视频上,但它也发生在我的横幅广告上。有时 Google 无法向我提供横幅广告。有谁知道为什么这不起作用?
我的广告代码:
override func viewDidLoad() {
super.viewDidLoad()
if let view = self.view as! SKView? {
// Load the SKScene from 'GameScene.sks'
let scene = MainMenu(view.bounds.size, self, nil)
scene.scaleMode = .aspectFill
// Present the scene
view.presentScene(scene)
view.ignoresSiblingOrder = true
view.showsFPS = false
view.showsNodeCount = false
view.showsPhysics = false
GADRewardBasedVideoAd.sharedInstance().delegate = self
GADRewardBasedVideoAd.sharedInstance().load(getRequest(),
withAdUnitID: rewardAdId)
// In this case, we instantiate the banner with desired ad size.
if GameViewController.bannerView == nil {
GameViewController.bannerView = GADBannerView(adSize: kGADAdSizeBanner)
GameViewController.bannerView.adUnitID = bannerId
GameViewController.bannerView.rootViewController = self
GameViewController.bannerView.load(getRequest())
GameViewController.bannerView.isHidden = true
addBannerViewToView(GameViewController.bannerView)
}
authenticateLocalPlayer()
QuestManager().checkForRefresh()
}
}
public func getRequest() -> GADRequest {
let request = GADRequest()
return request
}
public func displayRewardedVideo() {
if GADRewardBasedVideoAd.sharedInstance().isReady {
GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: self)
} else {
GameViewController.loadVideo()
}
}
public static func loadVideo(){
if !GADRewardBasedVideoAd.sharedInstance().isReady {
GADRewardBasedVideoAd.sharedInstance().load(GADRequest(),
withAdUnitID: rewardAdId)
}
}
func rewardBasedVideoAdDidClose(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
GADRewardBasedVideoAd.sharedInstance().load(getRequest(),
withAdUnitID: rewardAdId)
if let scene = gameScene {
scene.audioManager.unmmute()
}
print("Video did close")
}
我目前在一家提供大量免费移动应用程序的公司工作,作为自由职业者使用 Admob,所以我非常熟悉它。
无论如何,我从我公司的经理那里了解到(他们那里也有一位 Google Admob 顾问),应用程序中显示的广告可能取决于所在国家/地区用户在。例如,我在东南亚,而他们在欧洲。我遇到过一些时候我没有收到横幅广告,但他们总是收到各种类型的广告。
只要您的项目符合 Google Admob 的规则(例如,不要在短时间内展示插页式广告),而且你至少每隔一段时间收到一次广告,那么我相信你做的很好。
希望对您有所帮助。