Jac*_*nig 5 interstitial admob ios swift
我有一个应用程序,在 UIPageViewController 上的几页后显示插页式广告。通常广告是好的,我可以通过它自己的“X”按钮将其关闭。但有一些广告(尤其是我注意到的关于《列王的纷争》等游戏的广告)有时无论我点击“X”按钮多少次都不会消失。
我什至有一段时间会在 5 秒后关闭模式,例如插页式广告,但对于这些特定的广告,它不起作用。
这是我的代码:
func createAndLoadInterstitial() -> GADInterstitial {
let interst = GADInterstitial(adUnitID: "..")
interst.delegate = self
let request = GADRequest()
interst.load(request)
return interst
}
func showInterstitial() {
if interstitial.isReady {
self.interstitial.present(fromRootViewController: self)
self.timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.dismissInterstitial), userInfo: nil, repeats: false)
} else {
print("Ad wasn't ready")
}
}
func dismissInterstitial() {
self.dismiss(animated: true, completion: nil) //THIS WORKS FINE EXCEPT FOR THESE PARTICULAR ADS.
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 DispatchQueue.main.async 确保它位于主线程上,但同样,这并不是每次都有效。
有没有办法解决这个问题,或者我可能会错过什么?
谢谢。
以前没有使用过广告,但在游戏中看到过这种行为。我想到的事情:
可能的解决方案:创建一个透明视图并创建一个手势识别器并在点击时关闭怎么样?
| 归档时间: |
|
| 查看次数: |
2459 次 |
| 最近记录: |