Show Admob Interstitial ads between scenes in Swift SpriteKit

做~自己de王妃 提交于 2019-12-01 08:53:09

why dont you use NSNotificationCenter or delegates to call showInterstitial().

For example

In gameViewController add this in viewDidLoad

 NSNotificationCenter.defaultCenter().addObserver(self, selector: "showInterstitial"), name:"showInterAdKey", object: nil);

and when you want to show the ad from your scenes you use

 NSNotificationCenter.defaultCenter().postNotificationName("showInterAdKey", object: nil)

You could also use something like the helper I posted on github which makes this even easier and your ViewController stays clean https://github.com/crashoverride777/Swift-2-iAds-and-AdMob-Helper

You can also limit the frequency that admob will show interstitial ads via the admob website. In the settings for your interstitial, there are options to change the frequency of adverts popping up.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!