Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

282
Vistas
¿No puede encontrar el tipo 'GADInterstitial' en el alcance?

Acabo de actualizar el SDK de Google Mobile Ads a la versión 8.0, pero recibo este error:

No se puede encontrar el tipo 'GADInterstitial' en el alcance

También agregué este código a AppDelegate:

 GADMobileAds.sharedInstance().start(completionHandler: nil)

El SDK de Google Mobile Ads funcionó perfectamente hasta que actualicé a la versión 8.0

Nota: También uso Firebase Framework en mi aplicación.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Google ha actualizado el SDK sin decírselo a nadie. Echa un vistazo a la nueva guía de Admob para añadir un intersticial. Esencialmente, GADInterstitial ha cambiado a GADInterterstitialAd y también debe usar un Delegado diferente.

Gracias por eso Google.

over 4 years ago · Santiago Trujillo Denunciar

0

Aquí está el código de Admob Interstitial, solo copiar y pegar. Acabo de actualizar el SDK de Google Mobile Ads a la versión 8.0.

 import GoogleMobileAds class ViewController: UIViewController,GADFullScreenContentDelegate{ private var interstitial: GADInterstitialAd? override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADInterstitialAd.load(withAdUnitID:"ca-app-pub-3940256099942544/4411468910",request: request, completionHandler: { [self] ad, error in if let error = error { return } interstitial = ad interstitial?.fullScreenContentDelegate = self } ) } func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Ad did fail to present full screen content.") } func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did present full screen content.") } func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did dismiss full screen content.") } @IBAction func AddAction(_ sender: UIButton) { if interstitial != nil { interstitial.present(fromRootViewController: self) } else { print("Ad wasn't ready") } }

}

over 4 years ago · Santiago Trujillo Denunciar

0

Google Mobile Ads SDK 8.0 tiene un cambio dramático en sus interfaces API. Consulte el documento oficial de Google para anuncios intersticiales . Para completarlo, aquí está la referencia a la API heredada anterior a 8.0.

Los principales cambios son el delegado y la clase de anuncio:

viejo nuevo
GADInterstitialDelegate GADFullScreenContentDelegate
GADIntersticial GADIntersticialAd

Y en lugar de inicializar el anuncio de la forma heredada:

 interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") let request = GADRequest() interstitial.load(request)

ahora se inicializa de la siguiente manera

 let request = GADRequest() GADInterstitialAd.load(withAdUnitID:"ca-app-pub-3940256099942544/4411468910", request: request, completionHandler: { [self] ad, error in if let error = error { print("Failed to load interstitial ad with error: \(error.localizedDescription)") return } interstitial = ad interstitial?.delegate = self }

Y los nuevos métodos GADFullScreenContentDelegate:

 /// Tells the delegate that the ad failed to present full screen content. func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Ad did fail to present full screen content.") } /// Tells the delegate that the ad presented full screen content. func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did present full screen content.") } /// Tells the delegate that the ad dismissed full screen content. func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did dismiss full screen content.") }

Tenga en cuenta que ya no existe el método interstitialDidReceiveAd . En su lugar, comienza a presentar el anuncio en la devolución de llamada de finalización de GADInterstitialAd.load() , o en una etapa posterior para presentar el anuncio si se inicializa:

 if interstitial != nil { interstitial.present(fromRootViewController: self) } else { print("Ad wasn't ready") }
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda