我已经试着解决这个问题很长一段时间了,但是我想不出怎么解决它。
目前,我已经将Admob添加到我的项目中,并且间隙正在显示,但当我退出间隙时,它会返回到我之前的VC (在那里创建间隙实例)。
正如您在下面看到的,我正在尝试将它们添加到我的Tabbar函数中。但分段永远不会发生,在间隙之前也不会显示警报。我想展示广告,然后转到VC。我希望用户看到警报并在看到间隙之前按下"OK“。
任何帮助都是很棒的!
//TabBar Functions
func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
if (item.tag == 1) {
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.performSegueWithIdentifier("showStore", sender: nil)
} else if (item.tag == 2) {
let alert = UIAlertController(title: "Coming Soon!", message: "Loadout", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Got It!", style: .Default, handler: nil))
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.presentViewController(alert, animated: true, completion: nil)
return
} else if (item.tag == 3) {
let alert = UIAlertController(title: "Coming Soon!", message: "God's Tower", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Got It!", style: .Default, handler: nil))
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.presentViewController(alert, animated: true, completion: nil)
return
}
}发布于 2016-07-28 00:31:10
设置你的GADInterstitial的代表,一旦广告被取消,就开始分段。
// Add this where you're creating your GADInterstitial
interstitial.delegate = self
func interstitialDidDismissScreen(ad: GADInterstitial!) {
// Segue to your view controller here
}有关广告事件的完整列表,请参阅GADInterstitialDelegate implementation。
https://stackoverflow.com/questions/38598615
复制相似问题