I tried introducing admob's interstitial ad into the game app developed using SpriteKit, but it didn't work.If you don't use SpriteKit, ads will be displayed.
I would appreciate it if you could advise me on how to implement it with Spritekit.
We have introduced necessary items such as frameworks.
classGameViewController:UIViewController, GameSceneDelegate, GADIInterstitialDelegate{
var interstitial —GADIinterstitial=GADIinterstitial()
override func viewDidLoad(){
super.viewDidLoad()
self.interstitial=self.createAndLoadInterstitial()
NSTimer.scheduledTimerWithTimeInterval (10.0, target:self, selector:Selector("gameOver"), userInfo:nil, repeat:false)
}
func gameOver(){
print("call gameOver")
self.interstitial=self.createAndLoadInterstitial()
if self.interstitial.isReady {
interstitial.presentFromRootViewController(self)
} else {
print("not yet")
}
}
US>func createAndLoadInterstitial()->GADIinterstitial{
interstitial=GADIinterstitial (adUnitID: "ca-app-pub-6095430889174206/8832491082")
interstitial.delegate=self
// gadRequest.testDevices= [kGADSimulatorID]
interstitial.loadRequest(GADRequest())
return interstitial
}
I am using nend and I have never used spritekit, so I don't know much about it, but when I searched, I found a site like here.Sorry for the Objective-C content.
© 2024 OneMinuteCode. All rights reserved.