插页式广告与AdMob的在gameOverScene [英] Interstitial ad with admob at gameOverScene

查看:243
本文介绍了插页式广告与AdMob的在gameOverScene的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索高低有关使用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中设置视图控制器

Updated solution

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.

这篇关于插页式广告与AdMob的在gameOverScene的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆