问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/30494495/interstitial-ad-with-admob-at-gameoverscene