En esta página, se explican las migraciones para 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 se lance 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 la 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 realizar una corrección con 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 en 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 silencio del video
La propiedad isMuted
y el método setMute:
en GADVideoController
se reemplazan por una propiedad muted
.
Cambios en los anuncios adaptativos intercalados
Para optimizar el uso del espacio, los anuncios adaptables insertados inicialmente no ocupan espacio en el fotograma. Llamar a CGSizeFromGADAdSize(_:)
con un tamaño de anuncio adaptable intercalado ahora devuelve la altura 0
hasta que el SDK de anuncios de Google para dispositivos móviles devuelve un anuncio.
Se quitaron los anuncios de búsqueda personalizados
Se quitaron las siguientes clases sin reemplazo:
GADDynamicHeightSearchBannerView
GADDynamicHeightSearchRequest
GADSearchBannerView
Cambios en los códigos de error
Se modificaron 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 el 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 filtrado de contenido de anuncios.
Migra de la versión 10 a la 11
Objetivo de implementación mínimo
El objetivo de implementación mínimo se incrementó a iOS 12.
Versión mínima de Xcode
La versión mínima compatible de Xcode 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 solo publica anuncios 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 habilitaba 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 aplicación de AdMob a Firebase y, luego, integra el SDK de Google Analytics para Firebase en tu aplicación.
Cambios en la presentación de anuncios de pantalla completa
Los siguientes cambios afectan a los distintos formatos de anuncios:
- Inicio de aplicación
- Intersticial
- Recompensado
- Anuncio intersticial recompensado
El parámetro del controlador de vista en -canPresentFromRootViewController:error:
y -presentFromRootViewController:
admite valores nulos. Si se pasa nil, el anuncio se presenta desde el controlador de vista superior en la jerarquía de controladores de vista.
Se quitaron métodos
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() |
No hay reemplazo. |
GADMediationInterstitialAdEventDelegate | willBackgroundApplication() |
No hay reemplazo. |
GADMediationNativeAdEventDelegate | willBackgroundApplication() |
No hay reemplazo. |
GADMediationRewardedAdEventDelegate | didRewardUser(with reward: GADAdReward) |
En su lugar, usa didRewardUser() . |
GADMediatedUnifiedNativeAdNotificationSource | mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) |
No hay 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 . |
Se quitaron propiedades
Se quitaron las siguientes propiedades.
Clase v11.0.0 | Propiedad | Notas |
---|---|---|
GADMediationAdConfiguration | hasUserLocation | No hay 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 el registro de la versión del SDK
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 se ajusta al protocolo de 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 devuelven true
.
Clase | Propiedad |
---|---|
GADMediationAdConfiguration | isTestRequest |
GADCustomEventRequest | isTesting |
v10.0.0 | v11.0.0 |
|
|
Migra de la versión 9 a la versión 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 solo publica anuncios en dispositivos que ejecutan iOS 12 y versiones posteriores.
Si actualizas el SDK de anuncios de Google para dispositivos móviles a la versión 10.0.0, tu app no dejará de funcionar en dispositivos con iOS 11 y iOS 10, pero no se publicarán anuncios en esos dispositivos.
Ya no se admite la compilación con bitcode
Ahora es necesario inhabilitar el bitcode en tus aplicaciones para dispositivos móviles para integrar el SDK de anuncios de Google para dispositivos móviles.
Se quitaron los tipos
Tipo | Notas |
---|---|
GADGender | No hay reemplazo. |
GADMRewardBasedVideoAdNetworkAdapterProtocol | Todos los adaptadores de mediación recompensada 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 |
Se quitaron propiedades
Las siguientes propiedades se quitaron sin reemplazo.
Clase v10.0.0 | Propiedad |
---|---|
GADMediationAdRequest | userBirthday |
userGender | |
userHasLocation | |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription | |
GADCustomEventRequest | userHasLocation |
userLatitude | |
userLongitude | |
userLocationAccuracyInMeters | |
userLocationDescription |
Migra 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.
Si actualizas el SDK de anuncios de Google para dispositivos móviles a la versión 9.0.0, tu app no dejará de funcionar en dispositivos con iOS 10, pero 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 debe garantizar 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 vistas en tu app, es posible que no necesites realizar ningún cambio para garantizar esto. Considera si necesitas establecer la propiedad childViewControllerForStatusBarHidden
en el objeto rootViewController
de tu anuncio.
Cambia el nombre de adDidPresentFullScreenContent: a adWillPresentFullScreenContent:
No hay cambios en el comportamiento. El método del delegado se invoca justo antes de que se presente el anuncio, por lo que el nuevo nombre del método refleja mejor su funcionalidad.
Se quitó la API de configuración de la 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. Usar 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 que los publicadores que usan la mediación de AdMob agreguen la mediación en cascada para una red de publicidad que no sea una de las redes de publicidad admitidas.
Todos los protocolos de eventos personalizados están obsoletos. 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 interscroller, que antes no estaban disponibles.
API
En la siguiente tabla, se enumeran las APIs de adaptadores 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 delegado se devuelve con el controlador de finalización de carga de cada función de carga de la clase GADMediationAdapter .
|
|
-init |
-init |
|
-requestBannerAd:parameter: |
-loadBannerForAdConfiguration: |
|
-requestInterstitialAdWith |
-loadInterstitialFor |
|
-requestNativeAdWithParameter:
|
-loadNativeAdFor |
|
N/A | -loadInterscrollerAdFor |
|
N/A | -loadRewardedAdFor |
|
-presentFromRootViewController:
|
-presentFromViewController: |
|
-handlesUserClicks |
-handlesUserClicks |
|
-handlesUserImpressions |
-handlesUserImpressions |
Métodos de delegación
En la siguiente tabla, se enumeran los métodos delegados de eventos de anuncios de mediación correspondientes a los métodos delegados 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 del anuncio 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 el prefijo kGAD-
|
Se quitó el elemento. Usa constantes con el 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 .
|
Migra 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 más coherencia. Estas nuevas APIs de anuncios de pantalla completa tienen dos diferencias principales con respecto a 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 del objeto de anuncio y mantén una referencia a él.
- Asigna un delegado que controle las devoluciones de llamada de carga y visualización.
- Carga un anuncio.
- Verifica si el anuncio se cargó 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 cambio, 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 anuncio y proporciona un controlador de finalización de carga.
- En la devolución de llamada de finalización de la carga, mantén una referencia al anuncio cargado que se devuelve.
- Asigna un delegado que controle las devoluciones de llamada de visualización.
- Muestra el anuncio.
El nuevo enfoque proporciona los siguientes beneficios:
- Nunca tendrás una referencia a un anuncio que no se haya cargado.
- No es necesario que conserves 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 de delegado de un anuncio intersticial o registrar una clase que implementara el protocoloGADRewardedAdDelegate
en la propiedad de 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.En 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 establecer un solo delegado antes de cargar el anuncio. Los eventos de carga de anuncios, que son específicos de cada formato, se trasladan 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 no se carga.
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 llamadas para cuando se presenta el anuncio (correctamente o no) 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; }
Anuncio gráfico y control de recompensas
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
, estableces un GADFullscreenContentDelegate
como propiedad del 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 de GADRewardedAd
más reciente se introdujo en marzo de 2019 y ha sido la API de recompensas preferida durante más de 18 meses. Se le realizaron 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.
Se quitó la API heredada GADRewardedBasedVideoAd
en la versión 8.0.0 del SDK.
Baja de los banners inteligentes en favor de los banners adaptables
Los anuncios de banner inteligente dejaron de estar disponibles y se reemplazaron por los anuncios de banner adaptable. Los banners adaptables proporcionan un rendimiento superior y más flexibilidad para establecer el ancho del anuncio. Si prefieres seguir usando banners de ancho completo, 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
Se quitó la devolución de llamada de la aplicación de salida
Se quitó la devolución de llamada willLeaveApplication
para todos los formatos de anuncios y se reemplazó por los métodos applicationDidEnterBackground:
y sceneDidEnterBackground:
. Las APIs a nivel del SO te notifican cada vez que los usuarios abandonan tu app, independientemente de si se debe a una interacción con un anuncio o no.
Ten en cuenta que la devolución de llamada willLeaveApplication
nunca se diseñó para ser un controlador de clics en anuncios, y depender de esta devolución de llamada para registrar 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 contó un clic.
Cambios de nombre de la clase
En la siguiente tabla, se enumeran los nombres de clase específicos que se cambiaron o 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 v7.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 |
Se quitaron o reemplazaron métodos
En la siguiente tabla, se enumeran los cambios específicos de la versión 8. Resumen:
- Se quitaron los métodos y las propiedades que habían dejado de estar disponibles.
- Se quitaron los métodos de delegado
-willLeaveApplication:
para todos los formatos. - El nombre de la clase de red de publicidad se trasladó a la propiedad
GADResponseInfo
. - El identificador del dispositivo de prueba se movió a la propiedad
GADRequestConfiguration
.
Clase v7.68.0 | API de v7.68.0 | API de v8.0.0 | Notas |
---|---|---|---|
GADMobileAds | +configureWithApplicationID: | -startWithCompletionHandler: | El ID de la app ahora está establecido 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ódigo 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 |