I was looking for answers to all of this, and I found many examples in objective C (Google developer docs, etc.), and some answers are quick but don't use spritekit and are new to I just couldnโt bridge the gaps in these tutorials so bring it all together for my project. Honestly, I donโt care if the ad is triggered when the application is launched or in the game, Iโll just be happy that you can name the period of advertising, although I assume that the launch of the game is preferable.
I am sure that everything is configured correctly in gameviewcontroller.swift, but I do not know what to call it. Here is the code from my gameviewcontroller.swift:
import UIKit
import SpriteKit
import GoogleMobileAds
class GameViewController: UIViewController {
var interstitial : GADInterstitial!
func createAndLoadAd() -> GADInterstitial {
var ad = GADInterstitial()
ad.adUnitID = "ca-app-pub-4471013071748494/2980967718"
var request = GADRequest()
request.testDevices = [""]
return ad
}
... if , , ... ( , , :
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
self.interstitial = self.createAndLoadAd()
}
- ? - , , , ... . .