En esta página, se describen las migraciones de las versiones actuales y anteriores del SDK de anuncios de Google para dispositivos móviles en iOS. Se espera que la versión 12.0.0 esté disponible en febrero de 2025.
Migra de la versión 11 a la 12 del SDK
Actualiza a Xcode 16.0
La versión mínima compatible de Xcode aumentó a 16.0.
Compatibilidad con nombres de Swift
La versión 12.0.0 incluye cambios para seguir las convenciones de nomenclatura de los Lineamientos de diseño de la API de Swift. Estos cambios solo afectan a Swift. No se realizaron cambios en los nombres de las APIs de Objective-C.
Cambios en el prefijo de clase
Se realizaron los siguientes cambios en los prefijos de clase:
- Se quitó el prefijo
GAD
en los nombres de todos los tipos. - Se cambió el nombre del prefijo
GAM
aAdManager
. - Se cambió el nombre del prefijo
GADM
aMediation
.
Resuelve los errores
La mejor manera de resolver los errores resultantes de estos cambios es hacer una corrección de Fix-It.
Cómo resolver conflictos de nombres
Para resolver los conflictos de nombres, usa el espacio de nombres que proporciona el módulo. Por ejemplo, GADRequest
ahora se llama Request
. En el siguiente ejemplo, se asigna un espacio de nombres a la clase Request
del SDK de anuncios de Google para dispositivos móviles:
import GoogleMobileAds
...
var request: GoogleMobileAds.Request?
Lista detallada de cambios de Swift
En las siguientes tablas, se enumeran los cambios realizados en las APIs de Swift:
Versión 11 | Versión 12 |
---|---|
GADAdapterInitializationState |
AdapterInitializationState |
GADAdChoicesPosition |
AdChoicesPosition |
GADAdChoicesView |
AdChoicesView |
GADAdFormat |
AdFormat |
GADAdLoader |
AdLoader |
GADAdLoaderAdType |
AdLoaderAdType |
GADAdLoaderDelegate |
AdLoaderDelegate |
GADAdMetadataDelegate |
AdMetadataDelegate |
GADAdMetadataProvider |
AdMetadataProvider |
GADAdNetworkExtras |
AdNetworkExtras |
GADAdNetworkResponseInfo |
AdNetworkResponseInfo |
GADAdReward |
AdReward |
GADAdSize |
AdSize |
GADAdSizeDelegate |
AdSizeDelegate |
GADAdValue |
AdValue |
GADAdValuePrecision |
AdValuePrecision |
GADAppEventDelegate |
AppEventDelegate |
GADAppOpenAd |
AppOpenAd |
GADAppOpenSignalRequest |
AppOpenSignalRequest |
GADAudioVideoManager |
AudioVideoManager |
GADAudioVideoManagerDelegate |
AudioVideoManagerDelegate |
GADBannerSignalRequest |
BannerSignalRequest |
GADBannerView |
BannerView |
GADBannerViewDelegate |
BannerViewDelegate |
GADCustomEventExtras |
CustomEventExtras |
GADCustomEventRequest |
CustomEventRequest |
GADCustomNativeAd |
CustomNativeAd |
GADCustomNativeAdLoaderDelegate |
CustomNativeAdLoaderDelegate |
GADCustomNativeAdDelegate |
CustomNativeAdDelegate |
GADDebugOptionsViewControllerDelegate |
DebugOptionsViewControllerDelegate |
GADDebugOptionsViewController |
DebugOptionsViewController |
GADDisplayAdMeasurement |
DisplayAdMeasurement |
GADExtras |
Extras |
GADFullScreenPresentingAd |
FullScreenPresentingAd |
GADFullScreenContentDelegate |
FullScreenContentDelegate |
GADAdapterStatus |
AdapterStatus |
GADInitializationStatus |
InitializationStatus |
GADInterstitialAd |
InterstitialAd |
GADInterstitialSignalRequest |
InterstitialSignalRequest |
GADMediaAspectRatio |
MediaAspectRatio |
GADMediaContent |
MediaContent |
GADMediaView |
MediaView |
GADMobileAds |
MobileAds |
GADMultipleAdsAdLoaderOptions |
MultipleAdsAdLoaderOptions |
GADMuteThisAdReason |
MuteThisAdReason |
GADNativeAd |
NativeAd |
GADNativeAdLoaderDelegate |
NativeAdLoaderDelegate |
GADNativeAdView |
NativeAdView |
GADNativeAdCustomClickGestureOptions |
NativeAdCustomClickGestureOptions |
GADNativeAdDelegate |
NativeAdDelegate |
GADNativeAdImage |
NativeAdImage |
GADNativeAdImageAdLoaderOptions |
NativeAdImageAdLoaderOptions |
GADNativeAdInlineBehavior |
NativeAdInlineBehavior |
GADNativeAdInlineBehaviorOptions |
NativeAdInlineBehaviorOptions |
GADNativeAdMediaAdLoaderOptions |
NativeAdMediaAdLoaderOptions |
GADNativeAdUnconfirmedClickDelegate |
NativeAdUnconfirmedClickDelegate |
GADNativeAdViewAdOptions |
NativeAdViewAdOptions |
GADNativeMuteThisAdLoaderOptions |
NativeMuteThisAdLoaderOptions |
GADNativeSignalRequest |
NativeSignalRequest |
GADPresentationError |
PresentationError |
GADPublisherPrivacyPersonalizationState |
PublisherPrivacyPersonalizationState |
GADQueryInfo |
QueryInfo |
GADRequest |
Request |
GADRequestError |
RequestError |
GADRequestConfiguration |
RequestConfiguration |
GADResponseInfo |
ResponseInfo |
GADRewardedAd |
RewardedAd |
GADRewardedSignalRequest |
RewardedSignalRequest |
GADRewardedInterstitialAd |
RewardedInterstitialAd |
GADRewardedInterstitialSignalRequest |
RewardedInterstitialSignalRequest |
GADSearchBannerView |
SearchBannerView |
GADServerSideVerificationOptions |
ServerSideVerificationOptions |
GADSignal |
Signal |
GADSignalRequest |
SignalRequest |
GADVersionNumber |
VersionNumber |
GADVideoController |
VideoController |
GADVideoControllerDelegate |
VideoControllerDelegate |
Ad Manager | |
GAMBannerAdLoaderDelegate |
AdManagerBannerAdLoaderDelegate |
GAMBannerView |
AdManagerBannerView |
GAMBannerViewOptions |
AdManagerBannerViewOptions |
GAMInterstitialAd |
AdManagerInterstitialAd |
GAMRequest |
AdManagerRequest |
Mediación | |
GADMAdNetworkAdapter |
MediationAdNetworkAdapter |
GADMAdNetworkConnector |
MediationAdNetworkConnector |
GADMBannerAnimationType |
MediationBannerAnimationType |
GADMediatedUnifiedNativeAd |
MediationUnifiedNativeAd |
GADMediatedUnifiedNativeAdNotificationSource |
MediationUnifiedNativeAdNotificationSource |
GADMediationAd |
MediationAd |
GADMediationAdConfiguration |
MediationAdConfiguration |
GADMediationAdEventDelegate |
MediationAdEventDelegate |
GADMediationAdRequest |
MediationAdRequest |
GADMediationAdapter |
MediationAdapter |
GADMediationAppOpenAd |
MediationAppOpenAd |
GADMediationAppOpenAdEventDelegate |
MediationAppOpenAdEventDelegate |
GADMediationBannerAd |
MediationBannerAd |
GADMediationBannerAdConfiguration |
MediationBannerAdConfiguration |
GADMediationBannerAdEventDelegate |
MediationBannerAdEventDelegate |
GADMediationCredentials |
MediationCredentials |
GADMediationInterstitialAd |
MediationInterstitialAd |
GADMediationInterstitialAdConfiguration |
MediationInterstitialAdConfiguration |
GADMediationInterstitialAdEventDelegate |
MediationInterstitialAdEventDelegate |
GADMediationNativeAd |
MediationNativeAd |
GADMediationNativeAdConfiguration |
MediationNativeAdConfiguration |
GADMediationNativeAdEventDelegate |
MediationNativeAdEventDelegate |
GADMediationRewardedAd |
MediationRewardedAd |
GADMediationRewardedAdConfiguration |
MediationRewardedAdConfiguration |
GADMediationRewardedAdEventDelegate |
MediationRewardedAdEventDelegate |
GADMediationServerConfiguration |
MediationServerConfiguration |
Ofertas en tiempo real | |
GADRTBAdapter |
RTBAdapter |
GADRTBMediationSignalsConfiguration |
RTBMediationSignalsConfiguration |
GADRTBRequestParameters |
RTBRequestParameters |
Constantes
Versión 11 | Versión 12 |
---|---|
GADAdLoaderAdType.gamBanner |
AdLoaderAdType.adManagerBanner |
GADAdSizeBanner |
AdSizeBanner |
GADAdSizeFluid |
AdSizeFluid |
GADAdSizeFullBanner |
AdSizeFullBanner |
GADAdSizeInvalid |
AdSizeInvalid |
GADAdSizeLargeBanner |
AdSizeLargeBanner |
GADAdSizeLeaderboard |
AdSizeLeaderboard |
GADAdSizeMediumRectangle |
AdSizeMediumRectangle |
GADAdSizeSkyscraper |
AdSizeSkyscraper |
GoogleMobileAdsVersionString |
GoogleMobileAdsVersion |
Propiedades
Tipo | Versión 11 | Versión 12 |
---|---|---|
GADAdLoader | loading |
isLoading |
GADAudioVideoManager | audioSessionApplicationManaged |
isAudioSessionApplicationManaged |
GADBannerView | autoloadEnabled |
isAutoloadEnabled |
GADMobileAds | sharedInstance |
shared |
applicationMuted |
isApplicationMuted |
|
GADMuteThisAdReason | reasonDescription |
reason |
GADNativeAd | customMuteThisAdAvailable |
isCustomMuteThisAdAvailable |
GADNativeAdCustomClickGestureOptions | tapsAllowed |
areTapsAllowed |
GADNativeAdImageAdLoaderOptions | imageLoadingDisabled |
isImageLoadingDisabled |
GADNativeMuteThisAdLoaderOptions | customMuteThisAdRequested |
isCustomMuteThisAdRequested |
GADNativeSignalRequest | imageLoadingDisabled |
isImageLoadingDisabled |
customMuteThisAdRequested |
isCustomMuteThisAdRequested |
|
GADRequest | neighboringContentURLStrings |
neighboringContentURLs |
GADResponseInfo | extrasDictionary |
extras |
GADServerSideVerificationOptions | customRewardString |
customRewardText |
GADSignal | signalString |
signal |
GADSignalRequest | neighboringContentURLStrings |
neighboringContentURLs |
GADVideoController | customControlsRequested |
areCustomControlsRequested |
clickToExpandEnabled |
isClickToExpandEnabled |
|
GADVideoOptions | startMuted |
shouldStartMuted |
customControlsRequested |
areCustomControlsRequested |
|
clickToExpandRequested |
isClickToExpandRequested |
Funciones
Tipo | Versión 11 | Versión 12 |
---|---|---|
GADAdSize | GADPortraitInlineAdaptiveBannerAdSizeWithWidth(_:) |
portraitInlineAdaptiveBanner(width:) |
GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(_:) |
landscapeInlineAdaptiveBanner(width:) |
|
GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(_:) |
currentOrientationInlineAdaptiveBanner(width:) |
|
GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(_:, _:) |
inlineAdaptiveBanner(width:maxHeight:) |
|
GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
portraitAnchoredAdaptiveBanner(width:) |
|
GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
landscapeAnchoredAdaptiveBanner(width:) |
|
GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(_:) |
currentOrientationAnchoredAdaptiveBanner(width:) |
|
GADAdSizeFromCGSize(_:) |
adSizeFor(cgSize:) |
|
GADAdSizeFullWidthPortraitWithHeight(_:) |
fullWidthPortrait(height:) |
|
GADAdSizeFullWidthLandscapeWithHeight(_:) |
fullWidthLandscape(height:) |
|
GADAdSizeEqualToSize(_:, _:) |
isAdSizeEqualToSize(size1:size2:) |
|
IsGADAdSizeValid(_:) |
isAdSizeValid(size:) |
|
GADAdSizeIsFluid(_:) |
isAdSizeFluid(size:) |
|
CGSizeFromGADAdSize(_:) |
cgSize(for:) |
|
NSStringFromGADAdSize(_:) |
string(for:) |
|
NSValueFromGADAdSize(_:) |
nsValue(for:) |
|
GADAdSizeFromNSValue(_:) |
adSizeFor(nsValue:) |
|
GADClosestValidSizeForAdSizes(_:_:) |
closestValidSizeForAdSizes(original:possibleAdSizes:) |
|
GADAppEventDelegate | adView(_:didReceiveAppEvent:withInfo:) |
adView(_:didReceiveAppEvent:with:) |
interstitialAd(_:didReceiveAppEvent:withInfo:) |
adView(_:didReceiveAppEvent:with:) |
|
GADAppOpenAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:) |
present(from:) |
|
GADBannerView | load(withAdResponseString:) |
load(with:) |
GADInterstitial | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:) |
present(from:) |
|
GADRewardedAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:userDidEarnRewardHandler:) |
present(from:userDidEarnRewardHandler:) |
|
GADRewardedInterstitialAd | load(withAdResponseString:) |
load(with:) |
load(withAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
|
canPresent(fromRootViewController:) |
canPresent(from:) |
|
present(fromRootViewController:userDidEarnRewardHandler:) |
present(from:userDidEarnRewardHandler:) |
|
GADVersionNumber | GADGetStringFromVersionNumber(_ version: GADVersionNumber) |
string(for:) |
Mediación | ||
GADMAdNetworkAdapter | getBannerWith(_:) |
getBanner(with:) |
presentInterstitial(fromRootViewController:) |
presentInterstitial(from:) |
|
getNativeAd(withAdTypes:options:) |
getNativeAd(with:options:) |
|
GADMediatedUnifiedNativeAd | didRecordClickOnAsset(withName:view:viewController:) |
didRecordClickOnAsset(with:view:viewController:) |
GADMediationAdapter | setUpWith(_:completionHandler:) |
setUp(with:completionHandler:) |
GADMediationAdSize | present(fromRootViewController:) |
present(from:) |
GADMediationAppOpenAd | present(fromRootViewController:) |
present(from:) |
GADMediationInterstitialAd | present(fromRootViewController:) |
present(from:) |
GADMediationRewardedAd | present(fromRootViewController:) |
present(from:) |
GAMInterstitialAd | load(withAdManagerAdUnitID:request:completionHandler:) |
load(with:request:completionHandler:) |
Cambios en la API para controlar el estado de silenciamiento de los videos
La propiedad isMuted
y el método setMute:
en GADVideoController
se reemplazan por una propiedad muted
.
Cambios en los anuncios adaptables intercalados
Para optimizar el uso del espacio, los anuncios adaptables intercalados no ocupan espacio en el marco al principio. Llamar a CGSizeFromGADAdSize(_:)
con un tamaño de anuncio adaptable intercalado ahora muestra la altura 0
hasta que el SDK de anuncios de Google para dispositivos móviles muestra un anuncio.
Se quitaron los anuncios de búsqueda personalizados
Las siguientes clases se quitaron sin reemplazo:
GADDynamicHeightSearchBannerView
GADDynamicHeightSearchRequest
GADSearchBannerView
Cambios en los códigos de error
Se cambiaron los siguientes códigos de error:
Clase | Notas |
---|---|
GADErrorMediationNoFill |
Los errores ahora se muestran como GADErrorNoFill . |
GADErrorReceivedInvalidResponse |
Se reemplazó por GADErrorReceivedInvalidAdString . |
Se quitó GADSimulatorID
Se quitó GADSimulatorID
. Los simuladores ya están en modo de prueba de forma predeterminada.
Cambios en la segmentación personalizada
El diccionario customTargeting
en GADRequest
ahora usa Any
en lugar de String
como tipo de valor. Esto te permite pasar valores numéricos a la API.
Cambios en los parámetros de extras
- Ya no se admite pasar la clave
max_ad_content_rating
aadditionalParameters
. Para establecer una clasificación máxima del contenido del anuncio, consulta el artículo sobre filtrado de contenido de anuncios.
Cómo migrar de la versión 10 a la 11
Objetivo de implementación mínimo
El objetivo de implementación mínimo aumentó a iOS 12.
Versión mínima de Xcode
La versión mínima de Xcode compatible aumentó a 15.1.
Los anuncios dejan de publicarse en iOS 12
La versión 11.0.0 del SDK de anuncios de Google para dispositivos móviles publica anuncios solo en dispositivos que ejecutan iOS 13 y versiones posteriores.
Se quitó la dependencia de GoogleAppMeasurement
En la versión 11.0.0, se quitó la dependencia de GoogleAppMeasurement
. Esta dependencia que potenciaba el botón de activación de las métricas del usuario en AdMob se descontinuará a principios de 2024. Para seguir recopilando métricas del usuario en AdMob, vincula tu app de AdMob a Firebase y, luego, integra el SDK de Google Analytics para Firebase en tu app.
Cambios en la presentación de anuncios de pantalla completa
Los siguientes cambios afectan a los diversos formatos de anuncios:
- Apertura de la aplicación
- Intersticial
- Recompensado
- Anuncio intersticial recompensado
El parámetro del controlador de vista en -canPresentFromRootViewController:error:
y -presentFromRootViewController:
es nulo. Si se pasa nulo, el anuncio se
presenta desde el controlador de vista superior en la jerarquía de controladores de vista.
Métodos quitados
Se quitaron los siguientes métodos.
Tipo de v11.0.0 | Método | Notas |
---|---|---|
GADAppOpenAd | load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation) |
En su lugar, usa load(withAdUnitID adUnitID: String, request: GADRequest?) . |
GADMediationBannerAdEventDelegate | willBackgroundApplication() |
Sin reemplazo. |
GADMediationInterstitialAdEventDelegate | willBackgroundApplication() |
Sin reemplazo. |
GADMediationNativeAdEventDelegate | willBackgroundApplication() |
Sin reemplazo. |
GADMediationRewardedAdEventDelegate | didRewardUser(with reward: GADAdReward) |
En su lugar, usa didRewardUser() . |
GADMediatedUnifiedNativeAdNotificationSource | mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) |
Sin reemplazo. |
GADRequestConfiguration | setSameAppKeyEnabled(_ enabled: Bool) |
Usa setPublisherFirstPartyIDEnabled(_ enabled: Bool) en su lugar. |
tagForUnderAge(ofConsent underAgeOfConsent: Bool) |
En su lugar, usa la propiedad tagForUnderAgeOfConsent . |
|
tag(forChildDirectedTreatment childDirectedTreatment: Bool) |
En su lugar, usa la propiedad tagForChildDirectedTreatment . |
Propiedades quitadas
Se quitaron las siguientes propiedades.
Clase de v11.0.0 | Propiedad | Notas |
---|---|---|
GADMediationAdConfiguration | hasUserLocation | Sin reemplazo. |
userLatitude | ||
userLongitude | ||
userLocationAccuracyInMeters | ||
childDirectedTreatment | En su lugar, usa GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment . |
|
GADResponseInfo | adNetworkClassName | En su lugar, usa adNetworkClassName de loadedAdNetworkResponseInfo . |
Se quitó GADAdFormatUnknown
Se quitó GADAdFormatUnknown
, pero no tiene reemplazo.
Cambios en la versión del SDK de registro
La versión 11.0.0 quita sdkVersion
. Para registrar la versión del SDK de anuncios de Google para dispositivos móviles, usa versionNumber
.
Versión 10.0.0
GADMobileAds.sharedInstance().sdkVersion
Versión 11.0.0
GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)
Cambios en el manejo de errores de GADAdLoader
A partir de la versión 11.0.0, GADAdLoader
no realiza una solicitud de anuncio si su delegate
no cumple con el protocolo del delegado de los tipos de anuncios solicitados. Anteriormente, fallaba después de que se realizaba la solicitud de anuncio.
Cambios en el comportamiento de las pruebas
Consulta la tabla que muestra las condiciones actualizadas para cuando las siguientes propiedades muestran true
.
Clase | Propiedad |
---|---|
GADMediationAdConfiguration | isTestRequest |
GADCustomEventRequest | isTesting |
v10.0.0 | v11.0.0 |
|
|
Cómo migrar de la versión 9 a la 10
Los anuncios dejan de publicarse en iOS 11
La versión 10.0.0 del SDK de anuncios de Google para dispositivos móviles publica anuncios solo en dispositivos que ejecutan iOS 12 y versiones posteriores.
La actualización a la versión 10.0.0 del SDK de anuncios de Google para dispositivos móviles no dañará tu app en dispositivos iOS 11 y iOS 10. Sin embargo, no se publicarán anuncios en esos dispositivos.
Ya no se admite la compilación con código de bytes
Ahora es necesario inhabilitar el código de bytes en tus apps para dispositivos móviles para integrar el SDK de anuncios de Google para dispositivos móviles.
Tipos quitados
Tipo | Notas |
---|---|
GADGender | Sin reemplazo. |
GADMRewardBasedVideoAdNetworkAdapterProtocol | Todos los adaptadores de mediación de recompensas que se enumeran en Choose Networks dejaron de usar estos protocolos hace más de un año. Usa GADMediationAdapter para la mediación y los eventos personalizados. |
GADMRewardBasedVideoAdNetworkConnectorProtocol |
Propiedades quitadas
Las siguientes propiedades se quitan sin reemplazo.
Clase v10.0.0 | Propiedad |
---|---|
GADMediationAdRequest | userBirthday |
userGender | |
userHasLocation | |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription | |
GADCustomEventRequest | userHasLocation |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription |
Cómo migrar de la versión 8 a la 9
Los anuncios dejan de publicarse en iOS 10
La versión mínima de iOS que admite la versión 9.0.0 del SDK de anuncios de Google para dispositivos móviles es iOS 11.
La actualización a la versión 9.0.0 del SDK de anuncios de Google para dispositivos móviles no dañará tu app en dispositivos iOS 10. Sin embargo, no se publicarán anuncios en esos dispositivos.
Aplicación más estricta de los controles de la barra de estado
A partir de la versión 9.0.0, cuando presentes anuncios en formato de pantalla completa, tu app deberá asegurarse de que los anuncios puedan controlar la presentación de la barra de estado. Si no lo haces, verás un mensaje de error en los registros.
Según el diseño específico de los controladores de vista de tu app, es posible que no necesites hacer ningún cambio para garantizar esto. Considera si necesitas establecer la propiedad childViewControllerForStatusBarHidden
en el rootViewController
de tu anuncio.
Se cambió el nombre de adDidPresentFullScreenContent: a adWillPresentFullScreenContent:
No hay cambios de comportamiento. El método delegado se invoca justo antes de que se presente el anuncio, por lo que el nombre del método nuevo refleja mejor su funcionalidad.
Se quitó la API de configuración de ubicación en GADRequest.
Se borró - (void)setLocationWithLatitude:longitude:accuracy:
de GADRequest
, ya que Google no usa los datos de ubicación para segmentar anuncios. Usa APIs de terceros para proporcionar la información a las redes de publicidad de terceros si es necesario.
Baja de las interfaces de eventos personalizados
Los eventos personalizados permiten a los publicadores que usan la mediación de AdMob agregar mediación en cascada para una red de publicidad que no es una de las redes de publicidad compatibles.
Todos los protocolos de eventos personalizados dejaron de estar disponibles. En su lugar, usa los protocolos existentes GADMediationAdapter
y GADMediationAdEventDelegate
para lograr las mismas funcionalidades. Este cambio mejora la claridad y te permite crear eventos personalizados para los anuncios recompensados y los anuncios intercalados que antes no estaban disponibles.
API
En la siguiente tabla, se enumeran las APIs del adaptador de mediación correspondientes a las APIs de eventos personalizados que se deben usar a partir de la versión 9.0.0.
v8 | v9 | |
---|---|---|
GADCustomEventBanner GADCustomEventInterstitial GADCustomEventNativeAd |
GADMediationAdapter | GADMediationBannerAd GADMediationInterstitialAd GADMediationInterscrollerAd GADMediationRewardedAd GADMediationNativeAd |
delegate
|
El controlador de finalización de carga de cada función de carga de la clase GADMediationAdapter muestra el delegado.
|
|
-init |
-init |
|
-requestBannerAd:parameter: |
-loadBannerForAdConfiguration: |
|
-requestInterstitialAdWith |
-loadInterstitialFor |
|
-requestNativeAdWithParameter:
|
-loadNativeAdFor |
|
N/A | -loadInterscrollerAdFor |
|
N/A | -loadRewardedAdFor |
|
-presentFromRootViewController:
|
-presentFromViewController: |
|
-handlesUserClicks |
-handlesUserClicks |
|
-handlesUserImpressions |
-handlesUserImpressions |
Métodos delegados
En la siguiente tabla, se indican los métodos de delegado de eventos de anuncios de mediación correspondientes a los métodos de delegado de eventos personalizados que se deben usar a partir de la versión 9.0.0.
v8 | v9 | |
---|---|---|
GADCustomEventBannerDelegate GADCustomEventInterstitialDelegate GADCustomEventNativeAdDelegate |
GADMediationAdEventDelegate | GADMediationAd |
-customEventBanner:didReceiveAd: -customEventInterstitialDidReceiveAd:
|
El estado de carga de anuncios se incluye en el controlador de finalización de carga de cada función de carga en la clase GADMediationAdapter .
|
|
-customEventBanner:didFailAd: -customEventInterstitial:didFailAd:
|
||
-customEventBannerWasClicked: -customEventInterstitialWasClicked:
|
-reportClick |
|
-customEventBannerWill -customEventInterstitialWill
|
-willPresentFullScreenView |
|
-customEventBannerWill -customEventInterstitialWill
|
-willDismissFullScreenView |
|
-customEventBannerDid -customEventInterstitialDid
|
-didDismissFullScreenView |
|
-customEventBannerWill -customEventInterstitialWill
|
-willBackgroundApplication |
|
viewControllerFor |
-[GADMediationBannerAd view] |
Otros métodos y constantes quitados o reemplazados
Cambios en el método, la constante o la propiedad | |
---|---|
Constantes con prefijo kGAD-
|
Se quitó el elemento. Usa constantes con prefijo GAD- .
|
GADAdNetworkResponseInfo
|
Se quitaron credentials . En su lugar, usa adUnitMapping .
|
GADCustomNativeAd
|
mediaView en GADCustomNativeAd dejó de estar disponible.
Utiliza mediaContent en lugar de esta función.
|
APIs de compras directas desde la aplicación en GoogleMobileAds |
Se quitaron las APIs de inAppPurchase en GoogleMobileAds .
|
Cómo migrar de v7 a v8
La versión 8.0.0 del SDK de anuncios de Google para dispositivos móviles implementa algunos cambios significativos, así como cambios de nombre y eliminaciones de APIs.
Actualizaciones de la API de formato de pantalla completa
A partir de la versión 8.0.0, los anuncios intersticiales y recompensados comparten un estilo genérico de anuncio de pantalla completa para brindar mayor coherencia. Estas nuevas APIs de anuncios de pantalla completa tienen dos distinciones principales de las APIs de anuncios de pantalla completa de la versión 7:
Método de clase estático
load
.El enfoque anterior para cargar o mostrar un anuncio de pantalla completa es el siguiente:
- Crea una instancia de objeto de anuncio y mantén una referencia a ella.
- Asigna un delegado que controle la carga y muestre devoluciones de llamada.
- Carga un anuncio.
- Verifica si el anuncio se carga con
isReady
. - Muestra el anuncio.
En la versión 8, el enfoque cambia ligeramente. Las devoluciones de llamada de carga ya no forman parte de un delegado. En su lugar, se pasan al método
load
como un controlador de finalización:- Llama a un método de carga estático en la clase de anuncios y proporciona un controlador de finalización de carga.
- En la devolución de llamada de finalización de la carga, conserva una referencia al anuncio cargado que se muestra.
- Asigna un delegado que controle las devoluciones de llamada de programas.
- Muestra el anuncio.
El nuevo enfoque proporciona los siguientes beneficios:
- Nunca tendrás una referencia a un anuncio que no se cargó.
- No es necesario que mantengas un objeto de anuncio mientras se carga.
Eventos de anuncios coherentes.
Tipo de evento API existente API de v8 Eventos de carga GADInterstitialDelegate
oGADRewardedAdDelegate
GADInterstitialAdLoadCompletionHandler
oGADRewardedAdLoadCompletionHandler
Eventos de presentación GADFullScreenContentDelegate
Anteriormente, para detectar cualquier evento de anuncio, debías registrar una clase que implementara el protocolo
GADInterstitialDelegate
en la propiedad del delegado de un anuncio intersticial o una clase que implementara el protocoloGADRewardedAdDelegate
en la propiedad del delegado de un anuncio recompensado, según el formato que usaras. Este mismo delegado tenía métodos relacionados con el ciclo de vida de carga y presentación de un anuncio.Con la versión 8, los eventos de carga y presentación son independientes. Ahora puedes registrar un
GADFullScreenContentDelegate
en cualquier momento antes de mostrar un anuncio, en lugar de tener que configurar un solo delegado antes de cargarlo. Los eventos de carga de anuncios, que son específicos de cada formato, se mueven a un solo controlador de finalización de carga que se pasa en el método de carga.
Intersticial
Carga el anuncio
En los siguientes fragmentos de código, se muestra cómo cargar un anuncio intersticial y detectar eventos cuando el anuncio se carga correctamente o falla.
v7
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADInterstitialDelegate { var interstitial: GADInterstitial! override func viewDidLoad() { super.viewDidLoad() interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") interstitial.delegate = self let request = GADRequest() interstitial.load(request) } /// Tells the delegate an ad request succeeded. func interstitialDidReceiveAd(_ ad: GADInterstitial) { print("Interstitial ad loaded.") } /// Tells the delegate an ad request failed. func interstitial(_ ad: GADInterstitial, didFailToReceiveAdWithError error: GADRequestError) { print("Interstitial ad failed to load with error: \(error.localizedDescription)") } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADInterstitial *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"]; self.interstitial.delegate = self; GADRequest *request = [GADRequest request]; [self.interstitial loadRequest:request]; } /// Tells the delegate an ad request succeeded. - (void)interstitialDidReceiveAd:(GADInterstitial *)ad { NSLog(@"Insterstitial ad loaded."); } /// Tells the delegate an ad request failed. - (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error { NSLog(@"Interstitial ad failed to load with error: %@", [error localizedDescription]); }
v8
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADFullScreenContentDelegate { var interstitial: GADInterstitialAd? override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADInterstitialAd.load(withAdUnitID:"ca-app-pub-8123415297019784/4985798738", request: request, completionHandler: { (ad, error) in if let error = error { print("Failed to load interstitial ad with error: \(error.localizedDescription)") return } self.interstitial = ad self.interstitial.fullScreenContentDelegate = self } ) } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADInterstitialAd *interstitial; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GADRequest *request = [GADRequest request]; [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { if (error) { NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]); return; } self.interstitial = ad; self.interstitial.fullScreenContentDelegate = self; }]; }
Anuncio gráfico
v7
Swift
func showInterstitial() { ... if interstitial.isReady { interstitial.present(fromRootViewController: self) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showInterstitial: { ... if (self.interstitial.isReady) { [self.interstitial presentFromRootViewController:self]; } else { NSLog(@"Ad wasn't ready"); } }
v8
Swift
func showInterstitial() { ... if let ad = interstitial { ad.present(fromRootViewController: self) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showInterstitial: { ... if (self.interstitial) { [self.interstitial presentFromRootViewController:self]; } else { NSLog(@"Ad wasn't ready"); } }
Eventos de anuncios de presentación
En los siguientes fragmentos de código, se muestra cómo controlar las devoluciones de llamada para cuando se presenta el anuncio (con o sin éxito) y cuando se descarta.
v7
Swift
override func viewDidLoad() { super.viewDidLoad() interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910") interstitial.delegate = self ... } /// Tells the delegate that an interstitial will be presented. func interstitialWillPresentScreen(_ ad: GADInterstitial) { print("Interstitial ad will be presented.") } /// Tells the delegate the interstitial is to be animated off the screen. func interstitialWillDismissScreen(_ ad: GADInterstitial) { print("Interstitial ad will be dismissed.") } /// Tells the delegate the interstitial had been animated off the screen. func interstitialDidDismissScreen(_ ad: GADInterstitial) { print("Interstitial ad dismissed.") } /// Tells the delegate that a user click will open another app /// (such as the App Store), backgrounding the current app. /// /// This is not a reliable callback for an ad click event and is removed in /// version 8. If you wish to listen to an ad causing a user to leave the app, /// use applicationWillResignActive: or sceneWillResignActive: instead. func interstitialWillLeaveApplication(_ ad: GADInterstitial) { print("Interstitial ad will leave application.") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:"ca-app-pub-3940256099942544/4411468910"]; self.interstitial.delegate = self; ... } /// Tells the delegate that an interstitial will be presented. - (void)interstitialWillPresentScreen:(GADInterstitial *)ad { NSLog(@"Interstitial ad will be presented."); } /// Tells the delegate the interstitial is to be animated off the screen. - (void)interstitialWillDismissScreen:(GADInterstitial *)ad { NSLog(@"Interstitial ad will be dismissed."); } /// Tells the delegate the interstitial had been animated off the screen. - (void)interstitialDidDismissScreen:(GADInterstitial *)ad { NSLog(@"Interstitial ad dismissed."); } /// Tells the delegate that a user click will open another app /// (such as the App Store), backgrounding the current app. /// /// This is not a reliable callback for an ad click event and is removed in /// version 8. If you wish to listen to an ad causing a user to leave the app, /// use applicationWillResignActive: or sceneWillResignActive: instead. - (void)interstitialWillLeaveApplication:(GADInterstitial *)ad { NSLog(@"Interstitial ad will leave application."); }
v8
Swift
override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADInterstitialAd.load(withAdUnitID:"ca-app-pub-8123415297019784/4985798738", request: request, completionHandler: { (ad, error) in if let error = error { print(error.localizedDescription) return } self.interstitial = ad self.interstitial.fullScreenContentDelegate = self } ) } func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did present full screen content.") } func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Ad failed to present full screen content with error \(error.localizedDescription).") } func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Ad did dismiss full screen content.") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; GADRequest *request = [GADRequest request]; [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910" request:request completionHandler:^(GADInterstitialAd *ad, NSError *error) { if (error) { NSLog(@"interstitial:didFailToReceiveAdWithError: %@", [error localizedDescription]) return; } self.interstitial = ad; self.interstitial.fullScreenContentDelegate = self; }]; } - (void)adDidPresentFullScreenContent:(id)ad { NSLog(@"Ad did present full screen content."); } - (void)ad:(id )ad didFailToPresentFullScreenContentWithError:(NSError *)error { NSLog(@"Ad failed to present full screen content with error %@.", [error localizedDescription]); } - (void)adDidDismissFullScreenContent:(id )ad { NSLog(@"Ad did dismiss full screen content."); }
Recompensado
Carga el anuncio
v7
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADRewardedAdDelegate { /// The rewarded ad. var rewardedAd: GADRewardedAd? override func viewDidLoad() { super.viewDidLoad() rewardedAd = GADRewardedAd(adUnitID: "ca-app-pub-3940256099942544/1712485313") rewardedAd.delegate = self rewardedAd?.load(GADRequest()) { error in if let error = error { print("Rewarded ad failed to load with error: \(error.localizedDescription)") } else { print("Rewarded ad loaded.") } } } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADRewardedAd *rewardedAd; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.rewardedAd = [[GADRewardedAd alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313"]; self.rewardedAd.delegate = self; GADRequest *request = [GADRequest request]; [self.rewardedAd loadRequest:request completionHandler:^(GADRequestError * _Nullable error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); } else { NSLog(@"Rewarded ad loaded."); } }]; }
v8
Swift
import GoogleMobileAds import UIKit class ViewController: UIViewController, GADFullScreenContentDelegate { /// The rewarded ad. var rewardedAd: GADRewardedAd? override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADRewardedAd.load(withAdUnitID: "ca-app-pub-8123415297019784/9501821136", request: request, completionHandler: { (ad, error) in if let error = error { print("Rewarded ad failed to load with error: \(error.localizedDescription)") return } self.rewardedAd = ad self.rewardedAd?.fullScreenContentDelegate = self } ) } }
Objective-C
@import GoogleMobileAds; @import UIKit; @interface ViewController ()@property(nonatomic, strong) GADRewardedAd *rewardedAd; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GADRequest *request = [GADRequest request]; [GADRewardedAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313" request:request completionHandler:^(GADRewardedAd *ad, NSError *error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); return; } self.rewardedAd = ad; NSLog(@"Rewarded ad loaded."); self.rewardedAd.fullScreenContentDelegate = self; }
Muestra un anuncio gráfico y controla la recompensa
Los anuncios recompensados requieren que controles el evento cuando un usuario gana una recompensa. Con la versión 7 de la API de GADRewardedAd
, implementas rewardedAd:userDidEarnReward:
como parte del protocolo GADRewardedAdDelegate
.
En la versión 8, implementas GADUserDidEarnRewardHandler
para presentar el anuncio.
v7
Swift
func showRewardedAd() { ... if rewardedAd.isReady { rewardedAd.present(fromRootViewController: self delegate:self) } else { print("Ad wasn't ready") } } /// Tells the delegate that the user earned a reward. func rewardedAd(_ rewardedAd: GADRewardedAd, userDidEarnReward: GADAdReward) { // TODO: Reward the user. }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd.isReady) { [self.rewardedAd presentFromRootViewController:self delegate:self]; } else { NSLog(@"Ad wasn't ready"); } } /// Tells the delegate that the user earned a reward. - (void)rewardedAd:(GADRewardedAd *)rewardedAd userDidEarnReward:(GADAdReward *)reward { // TODO: Reward the user. }
v8
Swift
func showRewardedAd() { ... if let ad = rewardedAd { ad.present(fromRootViewController: self, userDidEarnRewardHandler: { let reward = ad.adReward // TODO: Reward the user. } ) } else { print("Ad wasn't ready") } }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd) { [self.rewardedAd presentFromRootViewController:self userDidEarnRewardHandler:^ { GADAdReward *reward = self.rewardedAd.adReward; // TODO: Reward the user. }]; } else { NSLog(@"Ad wasn't ready"); } }
Eventos de anuncios de presentación
Con la API de GADRewardedAd
, pasas un GADRewardedAdDelegate
al método que presenta el anuncio. Con la API de GADRewardedAd
, configuras un GADFullscreenContentDelegate
como una propiedad en el anuncio antes de presentarlo.
v7
Swift
func showRewardedAd() { ... if rewardedAd.isReady { rewardedAd.present(fromRootViewController: self delegate:self) } else { print("Ad wasn't ready") } } /// Tells the delegate that the rewarded ad was presented. func rewardedAdDidPresent(_ rewardedAd: GADRewardedAd) { print("Rewarded ad presented.") } /// Tells the delegate that the rewarded ad was dismissed. func rewardedAdDidDismiss(_ rewardedAd: GADRewardedAd) { print("Rewarded ad dismissed.") } /// Tells the delegate that the rewarded ad failed to present. func rewardedAd(_ rewardedAd: GADRewardedAd, didFailToPresentWithError error: Error) { print("Rewarded ad failed to present with error: \(error.localizedDescription).") }
Objective-C
- (void)showRewardedAd: { ... if (self.rewardedAd.isReady) { [self.rewardedAd presentFromRootViewController:self delegate:self]; } else { NSLog(@"Ad wasn't ready"); } } /// Tells the delegate that the rewarded ad was presented. - (void)rewardedAdDidPresent:(GADRewardedAd *)rewardedAd { NSLog(@"Rewarded ad presented."); } /// Tells the delegate that the rewarded ad failed to present. - (void)rewardedAd:(GADRewardedAd *)rewardedAd didFailToPresentWithError:(NSError *)error { NSLog(@"Rewarded ad failed to present with error: %@", [error localizedDescription]); } /// Tells the delegate that the rewarded ad was dismissed. - (void)rewardedAdDidDismiss:(GADRewardedAd *)rewardedAd { NSLog(@"Rewarded ad dismissed."); }
v8
Swift
override func viewDidLoad() { super.viewDidLoad() let request = GADRequest() GADRewardedAd.load(withAdUnitID: "ca-app-pub-8123415297019784/9501821136", request: request, completionHandler: { (ad, error) in if let error = error { print(error.localizedDescription) return } self.rewardedAd = ad self.rewardedAd?.fullScreenContentDelegate = self } ) } /// Tells the delegate that the rewarded ad was presented. func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Rewarded ad presented.") } /// Tells the delegate that the rewarded ad was dismissed. func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) { print("Rewarded ad dismissed.") } /// Tells the delegate that the rewarded ad failed to present. func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) { print("Rewarded ad failed to present with error: \(error.localizedDescription).") }
Objective-C
- (void)viewDidLoad { [super viewDidLoad]; GADRequest *request = [GADRequest request]; [GADRewardedAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/1712485313" request:request completionHandler:^(GADRewardedAd *ad, NSError *error) { if (error) { NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]); return; } self.rewardedAd = ad; NSLog(@"Rewarded ad loaded."); self.rewardedAd.fullScreenContentDelegate = self; } /// Tells the delegate that the rewarded ad was presented. - (void)adDidPresentFullScreenContent:(id)ad { NSLog(@"Rewarded ad presented."); } /// Tells the delegate that the rewarded ad failed to present. - (void)ad:(id )ad didFailToPresentFullScreenContentWithError:(NSError *)error { NSLog(@"Rewarded ad failed to present with error: %@", [error localizedDescription]); } /// Tells the delegate that the rewarded ad was dismissed. - (void)adDidDismissFullScreenContent:(id )ad { NSLog(@"Rewarded ad dismissed."); }
Eliminación de la API heredada de GADRewardedBasedVideoAd
La API más reciente de GADRewardedAd
se introdujo por primera vez en marzo de 2019 y ha sido la API de anuncios recompensados preferida durante más de 18 meses. Tiene más mejoras en comparación con la API de GADRewardedBasedVideoAd
heredada, incluida la capacidad de cargar más de un anuncio recompensado a la vez.
La API heredada de GADRewardedBasedVideoAd
se quita en la versión 8.0.0 del SDK.
Baja de los banners inteligentes a favor de los banners adaptables
Los anuncios de banner inteligente dejaron de estar disponibles en favor de los anuncios de banner adaptable. Los banners adaptables proporcionan un rendimiento superior y más flexibilidad para configurar el ancho del anuncio. Si prefieres seguir usando banners de pantalla completa, puedes hacerlo con el banner adaptable, como se muestra en el siguiente fragmento de código:
Swift
class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // Note: The safe area is not known until viewWillAppear. let adSize = getFullWidthAdaptiveAdSize() } func getFullWidthAdaptiveAdSize() -> GADAdSize { // Here safe area is taken into account, hence the view frame is used after the // view has been laid out. let frame = { () -> CGRect in if #available(iOS 11.0, *) { return view.frame.inset(by: view.safeAreaInsets) } else { return view.frame } }() return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width) } }
Objective-C
@implementation ViewController - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Note: The safe area is not known until viewWillAppear. GADAdSize adSize = [self getFullWidthAdaptiveAdSize]; } - (GADAdSize)getFullWidthAdaptiveAdSize { CGRect frame = self.view.frame; // Here safe area is taken into account, hence the view frame is used after // the view has been laid out. if (@available(iOS 11.0, *)) { frame = UIEdgeInsetsInsetRect(self.view.frame, self.view.safeAreaInsets); } return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(frame.size.width); } @end
Eliminación de la devolución de llamada de la app
Se quitó la devolución de llamada willLeaveApplication
para todos los formatos de anuncios en favor de los métodos applicationDidEnterBackground:
y sceneDidEnterBackground:
. El uso de APIs a nivel del SO te notifica cada vez que los usuarios abandonan tu app, independientemente de si se debe a una interacción con un anuncio.
Ten en cuenta que la devolución de llamada willLeaveApplication
nunca tuvo la intención de ser un controlador de clics de anuncios, y confiar en esta devolución de llamada para informar clics no produjo una métrica precisa. Por ejemplo, un clic en el ícono de AdChoices que inició un navegador externo invocó la devolución de llamada, pero no registró un clic.
Cambios de nombre de las clases
En la siguiente tabla, se enumeran los nombres de clase específicos que cambiaron o se quitaron en la versión 8. Resumen:
- Se cambió el nombre de todas las clases relacionadas con
GADUnifiedNativeAd
aGADNativeAd
. - Se quitaron
GADRewardBasedVideoAd
,GADNativeExpressAdView
yGADInstreamAd
. - Todas las clases con el prefijo
DFP
se reemplazaron por un prefijoGAM
.
Clase de la versión 7.68.0 | Clase v8.0.0 |
---|---|
DFPBannerView | GAMBannerView |
DFPBannerViewOptions | GAMBannerViewOptions |
DFPInterstitial | GAMInterstitialAd |
DFPRequest | GAMRequest |
GADRequestError | NSError |
GADUnifiedNativeAdView | GADNativeAdView |
GADUnifiedNativeAd | GADNativeAd |
GADUnifiedNativeAdAssetIdentifiers | GADNativeAdAssetIdentifiers |
GADUnifiedNativeAdDelegate | GADNativeAdDelegate |
GADUnifiedNativeAdUnconfirmedClickDelegate | GADNativeAdUnconfirmedClickDelegate |
GADNativeCustomTemplateAd | GADCustomNativeAd |
GADNativeCustomTemplateAdLoaderDelegate | GADCustomNativeAdLoaderDelegate |
GADNativeAdDelegate | GADCustomNativeAdDelegate |
GADInAppPurchase | Quitada |
GADInterstitial | GADInterstitialAd |
GADNativeExpressAdView | Quitada |
GADRewardBasedVideoAd | Quitada |
GADInstreamAd | Quitada |
GADInstreamAdView | Quitada |
Métodos quitados o reemplazados
En la siguiente tabla, se enumeran los cambios específicos de la versión 8. Resumen:
- Se quitaron los métodos y las propiedades obsoletos.
- Se quitaron los métodos delegados de
-willLeaveApplication:
para todos los formatos. - El nombre de la clase de la red de publicidad se trasladó a la propiedad
GADResponseInfo
. - El identificador del dispositivo de prueba se trasladó a la propiedad
GADRequestConfiguration
.
Clase de la versión 7.68.0 | API de v7.68.0 | API de v8.0.0 | Notas |
---|---|---|---|
GADMobileAds | +configureWithApplicationID: | -startWithCompletionHandler: | El ID de app ahora se establece en Info.plist. |
+disableAutomatedInApp |
-disableAutomatedInApp |
||
+disableSDKCrashReporting | -disableSDKCrashReporting | ||
GADRequest | testDevices | GADRequestConfiguration |
La propiedad testDeviceIdentifiers se aplica a todas las solicitudes de anuncios, mientras que la propiedad testDevices anterior se configuraba por solicitud. |
género | Quitada | ||
birthday | Quitada | ||
+sdkVersion | GADMobileAds.sharedInstance |
||
-setBirthday |
Quitada | ||
-setLocationWithDescription: | -setLocationWith |
||
-tagForChildDirectedTreatment: | [GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment] | ||
GADErrorCode | kGADError* | GADError* | Se quita el prefijo k de todas las constantes de códigos de error.
|
GADBannerView | hasAutoRefreshed | autoloadEnabled | |
inAppPurchaseDelegate | Quitada | ||
mediatedAdView | Quitada | ||
adNetworkClassName | responseInfo |
||
DFPBannerView | -setValidAdSizesWithSizes: | -setValidAdSizes: | |
DFPBannerViewOptions | -adSizeDelegate | Quitada | |
GADBannerViewDelegate | -adViewDidReceiveAd: | -bannerViewDidReceiveAd: | |
-adView:didFailToReceive |
-bannerView:didFailToReceive |
||
-adViewWillPresentScreen: | -bannerViewWillPresentScreen: | ||
-adViewWillDismissScreen: | -bannerViewWillDismissScreen: | ||
-adViewDidDismissScreen: | -bannerViewDidDismissScreen: | ||
-adViewWillLeaveApplication: | Quitada | ||
GADNativeCustomTemplateAd | templateID | GADCustomNativeAd.formatID | |
-performClickOnAssetWithKey: |
-performClickOnAssetWithKey: | ||
GADNativeAdImageAd |
preferredImageOrientation | GADNativeAdMediaAdOptions |
|
GADInterstitial | inAppPurchaseDelegate | Quitada | |
isReady | Quitada | En su lugar, usa canPresentFrom |
|
hasBeenUsed | Quitada | ||
-init | -initWithAdUnitID: | ||
-setAdUnitID: | -initWithAdUnitID: | ||
adNetworkClassName | responseInfo |
||
-interstitialWill |
Quitada | ||
GADUnifiedNativeAd | videoController | mediaContent.videoController | |
adNetworkClassName | responseInfo |