我已经在网上搜索高低有关使用SWIFT的时候添加一个间隙AdMob的广告在比赛现场上与SpriteKit方向。
I have searched the internet high and low for direction regarding adding an interstitial admob ad at the game over scene with SpriteKit when using swift.
在谷歌文档仍然使用的OBJ-C。
The google documentation still uses Obj-C.
我已经收集到目前为止,我需要初始化中的viewController的广告,然后从游戏叫过来情景吗?
What I have gathered so far is that I need to initialize the ad in the viewController and then call it from the game over scene?
任何意见将是极大的AP preciated。
Any advice would be greatly appreciated.
我在viewDidLoad中设置视图控制器
I set in the view controller in the viewdidload
NSNotificationCenter.defaultCenter().addObserver(self, selector:"loadAndShow", name: "loadAndShow", object: nil)
然后,我有一个单独的功能(在的ViewController)呼吁loadAndShow ......这将加载和显示插播式广告是否准备好
then I have a separate function (in the viewcontroller ) called loadAndShow ... which will load and show the interstitial ad if ready
然后从gameOverScene,我称之为
then from the gameOverScene, I call
NSNotificationCenter.defaultCenter().postNotificationName("loadAndShow", object: nil)
将运行从VC的功能,以present广告。完美。
which will run the function from the VC to present the ad. Works perfectly.