Admob横幅伤害iOS帧率

时间:2016-10-25 02:38:42

标签: ios swift sprite-kit admob

我正在使用swift和spritekit创建一个iOS游戏,并且遇到了一个显示来自admob的广告的问题。测试广告工作正常,我没有任何问题,但一旦我开始调用实时广告,我的框架显着下降,真的会伤害游戏玩法。我不太确定问题是什么,并试图遵循文档,无法弄清问题是什么。这是我的代码,用于处理广告的调用和显示。非常感谢任何帮助,谢谢。

func createIntAd() {

    interstitial = GADInterstitial(adUnitID: "ca-app-pub-8872492368219215/3269040884")
    self.interstitial.load(GADRequest())
}

func showAd()
{
    if (self.interstitial.isReady)
    {
        self.interstitial.present(fromRootViewController: self)//Whatever  shows the ad
    }
}

override func viewDidLoad() {
    super.viewDidLoad()
    _ = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(createIntAd), userInfo: nil, repeats: true)

    print("Google Mobile Ads SDK version: " + GADRequest.sdkVersion())
    bannerView.adUnitID = "ca-app-pub-8872492368219215/1792307689"
    bannerView.rootViewController = self
    bannerView.load(GADRequest())

    if let view = self.view as! SKView? {
        // Load the SKScene from 'GameScene.sks'
        if let scene = GameScene(fileNamed: "GameScene") {
            // Set the scale mode to scale to fit the window
            scene.scaleMode = .aspectFill
            scene.adDelegate = self
            // Present the scene
            view.presentScene(scene)
        }

        view.ignoresSiblingOrder = true

        view.showsFPS = false
        view.showsNodeCount = false
        createIntAd()
    }
    FIRMessaging.messaging().subscribe(toTopic: "/topics/news")
}

0 个答案:

没有答案