Admob间隙广告在iOS设备上未全屏显示
我使用spritekit制作了一个游戏,并根据google提供的文档实现了admob中间广告。在模拟器中一切正常,广告在正确的时间按预期呈现全屏。问题是,当我在iphone6s上运行时,广告并没有填满整个屏幕,只是黑屏上的一小部分。我已经在gameviewController上实现了所有admob代码,并在游戏场景中使用观察者调用它 类GameViewController:UIViewController{Admob间隙广告在iOS设备上未全屏显示,ios,swift,admob,interstitial,Ios,Swift,Admob,Interstitial,我使用spritekit制作了一个游戏,并根据google提供的文档实现了admob中间广告。在模拟器中一切正常,广告在正确的时间按预期呈现全屏。问题是,当我在iphone6s上运行时,广告并没有填满整个屏幕,只是黑屏上的一小部分。我已经在gameviewController上实现了所有admob代码,并在游戏场景中使用观察者调用它 类GameViewController:UIViewController{ var interstitial: GADInterstitial! override
var interstitial: GADInterstitial!
override func viewDidLoad() {
super.viewDidLoad()
interstitial = createAndLoadInterstitial()
NotificationCenter.default.addObserver(self, selector: #selector(GameViewController.showIntersticialAd), name: Notification.Name("showIntersticialAd"), object: nil)
if let view = self.view as! SKView? {
let scene = MenuScene(size: view.bounds.size)
scene.scaleMode = .aspectFill
view.presentScene(scene)
view.ignoresSiblingOrder = true
view.showsFPS = false
view.showsNodeCount = false
}
}
@objc func showIntersticialAd() {
if interstitial.isReady {
interstitial.present(fromRootViewController: self)
} else {
print("Ad not ready")
}
}
}
扩展GameViewController:GadalDelegate{
func createAndLoadInterstitial() -> GADInterstitial {
let interstitial = GADInterstitial(adUnitID: "ca-app-pub-4828696079960529/6898313363")
interstitial.delegate = self
interstitial.load(GADRequest())
return interstitial
}
func interstitialDidDismissScreen(_ ad: GADInterstitial) {
interstitial = createAndLoadInterstitial()
}
}
我在互联网和admob文档中搜索了很多,但没有找到发生这种情况的原因。
@objc func showIntertalads(){
如果!中间的.isReady{
填隙.load(GADRequest())
}如果interstitual.isReady{
间隙。存在(来自rootViewController:(UIApplication.shared.keyWindow?.rootViewController)!)
}
}
@objc func showIntertalads(){
如果!中间的.isReady{
填隙.load(GADRequest())
}如果interstitual.isReady{
间隙。存在(来自rootViewController:(UIApplication.shared.keyWindow?.rootViewController)!)
}
}
捕获日志并更新您的问题我也有同样的问题。屏幕上只有一部分被广告内容覆盖,但其他区域则是黑色的。在你的问题中捕获日志和更新我也有同样的问题。屏幕上只有一部分被广告内容覆盖,但其他区域则是黑色的。