I have a banner ad and an interstitial ad. They are appearing when I use the adUnitID's for testing purposes that AdMob gives you, but neither of them are showing when I use live ads. The banner just doesn't appear at all. When the interstitial ad appears, it is just completely black. The adUnitID's are correct. The ads on my other apps are currently appearing just fine. The problem occurs both when I use the iOS simulator and my device. Any ideas?
var interstitial: GADInterstitial!
func createAndLoadAd() -> GADInterstitial{
let ad = GADInterstitial(adUnitID: "ca-app-pub-7863284438864645/1835730011")
let request = GADRequest()
ad.loadRequest(request)
return ad
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
authenticateLocalPlayer()
self.bannerView.adUnitID = "ca-app-pub-7863284438864645/9358996816"
self.bannerView.rootViewController = self
let request: GADRequest = GADRequest()
self.bannerView.loadRequest(request)
self.interstitial = self.createAndLoadAd()
}
override func viewDidAppear(animated: Bool) {
_ = GADRequest()
//request.testDevices = ["2077ef9a63d2b398840261c8221a0c9b"]
showAd()
}
func showAd(){
if(self.interstitial.isReady){
print("ad ready")
self.interstitial.presentFromRootViewController(self)
}
else{
print("ad not ready")
self.interstitial = createAndLoadAd()
}
}