【问题标题】:Check if Admob interstitial is completed检查 Admob 插页式广告是否完成
【发布时间】:2019-05-15 16:22:08
【问题描述】:

我正在构建我的 iOS 应用程序,并添加了一些广告。但是我刚刚发现了一个问题。

当 AdMob 插页式广告投放时,广告结束后不会进行转场。

if self.interstitial.isReady
{    
    self.interstitial.present(fromRootViewController: self)
    self.performSegue(withIdentifier: "History", sender: self)
}

所以,一旦我按下“X”关闭广告,它就不会执行转场。它只是保持在与以前相同的页面上。

我该如何解决这个问题?谢谢!

编辑


因此,当我单击“保存”按钮时,此代码将运行。

if self.interstitial.isReady
{
   self.interstitial.present(fromRootViewController: self)
   self.interstitialDidDismissScreen(self.interstitial) //Calling the dismiss function here                                          
}  

//Advertisement will dismiss from the screen
func interstitialDidDismissScreen(_ ad: GADInterstitial)
{
    self.performSegue(withIdentifier: "History", sender: self)
}

不知何故,它仍然不会执行转场。

【问题讨论】:

    标签: ios swift admob segue


    【解决方案1】:

    最好的方法是在用户按下 x 时执行 segue。要做到这一点,请使用此功能:

    func interstitialDidDismissScreen(_ ad: GADInterstitial) {
    
        //Perform your segue
    }
    

    【讨论】:

    • 所以,在检查了这个之后。我刚刚意识到我需要将它添加到“代表”。现在它工作得很好,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 2020-09-21
    • 2018-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多