OGeek|极客世界-中国程序员成长平台

标题: ios - AdMob Ios 导致的帧率下降 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:45
标题: ios - AdMob Ios 导致的帧率下降

一段时间以来,我一直在游戏中遇到一个奇怪的延迟问题,我终于查明了罪魁祸首。阿德莫布。在对我的应用程序进行了一些基本测试后,我意识到 Admob 每加载 10 次左右就会导致 10+ fps 下降。这是我的 AdMob 代码。

func initializeBanner() {
    // Create a banner ad and add it to the view hierarchy.
    bannerView.adUnitID = "ca-app-pub-8237297232584070/6035957145"
    bannerView.rootViewController = viewController
    bannerView.frame = CGRect(x:0.0,
                              yself.view?.frame.size.height)! - bannerView.frame.size.height,
                              width:bannerView.frame.size.width,
                              height:bannerView.frame.size.height)
}
func loadRequest() {
    let request = GADRequest()
    request.testDevices = [kGADSimulatorID]
    bannerView.load(request)
}
func createAd(){
    initializeBanner()
    loadRequest()
    openAdd()
}
func openAdd(){
    view!.addSubview(bannerView)
}

当用户启动应用程序时调用一次。我的问题是什么?这很常见吗?有解决办法吗?

注意:我收到了警告

You are currently using version 7.19.1 of the SDK. Please consider updating your SDK to the most recent SDK version to get the latest features and bug fixes. The latest SDK can be downloaded from (Stack overflow doesn't allow link). A full list of release notes is available at https://developers.google.com/admob/ios/rel-notes.



Best Answer-推荐答案


这很常见,另一方面可以检查是否行:

GADMobileAds.configure(withApplicationID: "ca-app-pub-8237297232584070~4978026344")

已成功,您可以等待加载游戏直到那时。这可能会有所帮助。

注意:不建议在游戏场景播放时展示广告

关于ios - AdMob Ios 导致的帧率下降,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44223522/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4