Garrett Cox
Garrett Cox

Reputation: 713

Interstitial ad with admob at gameOverScene

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.

The google documentation still uses Obj-C.

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?

Any advice would be greatly appreciated.

Upvotes: 0

Views: 180

Answers (1)

Garrett Cox
Garrett Cox

Reputation: 713

Updated solution

I set in the view controller in the viewdidload

 NSNotificationCenter.defaultCenter().addObserver(self, selector:"loadAndShow", name: "loadAndShow", object: nil)

then I have a separate function (in the viewcontroller ) called loadAndShow ... which will load and show the interstitial ad if ready

then from the gameOverScene, I call

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

which will run the function from the VC to present the ad. Works perfectly.

Upvotes: 1

Related Questions