¿Por qué mi intersticial admob funciona bien en el simulador xcode pero no en mis dispositivos de prueba (iphone 4s y ipod 5th gen)?
Así que tengo esta aplicación que tiene un anuncio publicitario admob y un anuncio intersticial. El banner funciona bien en todas las pantallas. Se supone que el anuncio intersticial solo se carga en una pantalla, y se carga bien cuando lo pruebo en el simulador de xcode. Pero cuando pruebo en mi iPhone y iPod, el interés no se carga y aparece este error: Error de solicitud: Recibí una respuesta no válida.interstitialDidFailToReceiveAdWithError:
Solicitud de error: Recibió una respuesta no válida. ¿Alguien se ha encontrado con esto antes o puede saber por qué sucede esto? Aquí está el código con el que estoy trabajando:
// interstitial ad variable...
var interstitial: GADInterstitial?
var timer:NSTimer?
var loadRequestAllowed = true
let screen = UIScreen.mainScreen().bounds
let IS_IPAD = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad
var buttonHeight:CGFloat = 0.0
var buttonOffsetY:CGFloat = 0.0
let statusbarHeight:CGFloat = 20.0
var iAdSupported = false
// load the interstitial
//Admob Interstitial
buttonHeight = IS_IPAD ? 30 : 20
buttonOffsetY = statusbarHeight
if !iAdSupported {
interstitial = createAndLoadInterstitial()
} // closes if !iAdSupported
// presentInterstitial()
timer = NSTimer.scheduledTimerWithTimeInterval(1, target:self, selector: Selector("presentInterstitial"), userInfo: nil, repeats: false)
println("the timer made presentInterstitial run")
//Interstitial func
func createAndLoadInterstitial()->GADInterstitial {
println("createAndLoadInterstitial")
var interstitial = GADInterstitial(adUnitID: "ca-app-pub-4471013071748494/2225255714")
interstitial.delegate = self
interstitial.loadRequest(GADRequest())
return interstitial
} // closes createAndLoadInterstitial …
func presentInterstitial() {
if let isReady = interstitial?.isReady {
interstitial?.presentFromRootViewController(self)
println("presentInterstitial function ran")
} // closes if let isReady
} // closes presentInterstitial …
//Interstitial delegate
func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
println("interstitialDidFailToReceiveAdWithError:\(error.localizedDescription)")
// ResultsBtn?.enabled = false
interstitial = createAndLoadInterstitial()
} // closes interstitial …