Admob广告有时会在应用加载时播放

时间:2016-02-15 21:46:41

标签: swift admob

有时,当我的应用启动时,我会听到广告中的音频。这完全是不受欢迎的行为。广告只应在游戏结束时展示,而不是在启动时展示。我的所有与广告相关的代码都在下方。有人能发现它的问题吗?

override func viewDidLoad() {
    super.viewDidLoad()

    if NoAdsPurchased == false {
        print("Google Mobile Ads SDK version: \(GADRequest.sdkVersion())")
        if UseTestAdvertisements == true {
            self.interstitial = GADInterstitial(adUnitID:"ca-app-pub-3940256099942544/4411468910")
        } else {
            self.interstitial = GADInterstitial(adUnitID:"ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX")
        }
        request = GADRequest()
        interstitial.loadRequest(request)
        interstitial.delegate = self
    }

}

func buttonActionGameOver(sender:UIButton) {

    if NoAdsPurchased == false {
        //Show ad
        self.interstitial.presentFromRootViewController(self)
    }

func interstitialDidDismissScreen(temp:GADInterstitial) {
    print("diddismiss")
    if (NoAdsPurchased == false) {
        if UseTestAdvertisements == false {
            self.interstitial = GADInterstitial(adUnitID:"ca-app-pub-4760046923514498/4070660162")
        } else {
            self.interstitial = GADInterstitial(adUnitID:"ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX")
        }

    request = GADRequest()
    request.testDevices = ["2077ef9a63d2b398840261c8221a0c9b"]
    interstitial.loadRequest(request)
    interstitial.delegate = self
    }
}

0 个答案:

没有答案