Migração do SDK

Esta página aborda migrações para versões atuais e anteriores do SDK dos anúncios para dispositivos móveis do Google para iOS. A versão 12.0.0 será lançada em fevereiro de 2025.

Migrar da versão v11 para a v12 do SDK

Fazer upgrade para o Xcode 16.0

A versão mínima do Xcode com suporte foi aumentada para 16.0.

Suporte a nomenclatura do Swift

A versão 12.0.0 inclui mudanças para seguir as convenções de nomenclatura nas Diretrizes de design da API do Swift. Essas mudanças afetam apenas o Swift. Nenhuma mudança de nomenclatura foi feita nas APIs Objective-C.

Mudanças no prefixo da classe

As seguintes mudanças foram feitas nos prefixos de classe:

  • O prefixo GAD foi removido dos nomes de todos os tipos.
  • O prefixo GAM foi renomeado como AdManager.
  • O prefixo GADM foi renomeado como Mediation.

corrigir erros.

A melhor maneira de resolver os erros resultantes dessas alterações é fazer uma correção do Fix-It.

Resolver conflitos de nomenclatura

Para resolver conflitos de nomenclatura, use o namespace fornecido pelo módulo. Por exemplo, GADRequest agora se chama Request. O namespace de exemplo a seguir é a classe Request do SDK dos anúncios para dispositivos móveis do Google:

import GoogleMobileAds
...
var request: GoogleMobileAds.Request?

Lista detalhada de mudanças do Swift

As tabelas a seguir listam as mudanças feitas nas APIs Swift:

Versão 11 Versão 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
Mediação
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
Lances em tempo real
GADRTBAdapter RTBAdapter
GADRTBMediationSignalsConfiguration RTBMediationSignalsConfiguration
GADRTBRequestParameters RTBRequestParameters

Constantes

Versão 11 Versão 12
GADAdLoaderAdType.gamBanner AdLoaderAdType.adManagerBanner
GADAdSizeBanner AdSizeBanner
GADAdSizeFluid AdSizeFluid
GADAdSizeFullBanner AdSizeFullBanner
GADAdSizeInvalid AdSizeInvalid
GADAdSizeLargeBanner AdSizeLargeBanner
GADAdSizeLeaderboard AdSizeLeaderboard
GADAdSizeMediumRectangle AdSizeMediumRectangle
GADAdSizeSkyscraper AdSizeSkyscraper
GoogleMobileAdsVersionString GoogleMobileAdsVersion

Propriedades

Tipo Versão 11 Versão 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

Funções

Tipo Versão 11 Versão 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:)
Mediação
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:)

Mudanças na API para controlar o estado de silenciamento do vídeo

A propriedade isMuted e o método setMute: em GADVideoController são substituídos por uma propriedade muted.

Mudanças nos anúncios inline adaptativos

Para otimizar a utilização do espaço, os anúncios inline adaptáveis não ocupam espaço no frame. Chamar CGSizeFromGADAdSize(_:) com um tamanho de anúncio adaptativo inline agora retorna a altura 0 até que o SDK dos anúncios para dispositivos móveis do Google retorne um anúncio.

Anúncios personalizados de pesquisa removidos

As seguintes classes foram removidas sem substituição:

  • GADDynamicHeightSearchBannerView
  • GADDynamicHeightSearchRequest
  • GADSearchBannerView

Mudanças nos códigos de erro

Os seguintes códigos de erro foram alterados:

Turma Observações
GADErrorMediationNoFill Os erros agora são retornados como GADErrorNoFill.
GADErrorReceivedInvalidResponse Foi substituído por GADErrorReceivedInvalidAdString.

GADSimulatorID removido

GADSimulatorID foi removido. Os simuladores já estão no modo de teste por padrão.

Mudanças na segmentação personalizada

O dicionário customTargeting em GADRequest agora usa Any em vez de String como o tipo de valor. Isso permite transmitir valores numéricos para a API.

Mudanças nos parâmetros extras

Migrar da v10 para a v11

Destino de implantação mínimo

O destino de implantação mínimo foi aumentado para o iOS 12.

Versão mínima do Xcode

A versão mínima do Xcode com suporte foi aumentada para 15.1.

Os anúncios param de ser veiculados no iOS 12

O SDK dos anúncios para dispositivos móveis do Google versão 11.0.0 veicula anúncios apenas em dispositivos com iOS 13 ou mais recente.

A dependência do GoogleAppMeasurement foi removida

Na versão 11.0.0, a dependência de GoogleAppMeasurement foi removida. Essa dependência que acionava a alternância de métricas do usuário na AdMob será descontinuada no início de 2024. Para continuar coletando métricas do usuário na AdMob, vincule seu app da AdMob ao Firebase e integre o SDK do Google Analytics para Firebase ao seu app.

Mudanças na apresentação de anúncios em tela cheia

As mudanças a seguir afetam os vários formatos de anúncio:

  • Abertura do app
  • Intersticial
  • Premiado
  • Intersticial premiado

O parâmetro do controlador de visualização em -canPresentFromRootViewController:error: e -presentFromRootViewController: é anulável. Se o valor nulo for transmitido, o anúncio será apresentado pelo controlador de visualização mais alto na hierarquia.

Métodos removidos

Os métodos a seguir foram removidos.

v11.0.0 Type Método Observações
GADAppOpenAd load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation) Use load(withAdUnitID adUnitID: String, request: GADRequest?).
GADMediationBannerAdEventDelegate willBackgroundApplication() Sem substituição.
GADMediationInterstitialAdEventDelegate willBackgroundApplication() Sem substituição.
GADMediationNativeAdEventDelegate willBackgroundApplication() Sem substituição.
GADMediationRewardedAdEventDelegate didRewardUser(with reward: GADAdReward) Use didRewardUser().
GADMediatedUnifiedNativeAdNotificationSource mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) Sem substituição.
GADRequestConfiguration setSameAppKeyEnabled(_ enabled: Bool) Use setPublisherFirstPartyIDEnabled(_ enabled: Bool).
tagForUnderAge(ofConsent underAgeOfConsent: Bool) Use a propriedade tagForUnderAgeOfConsent.
tag(forChildDirectedTreatment childDirectedTreatment: Bool) Use a propriedade tagForChildDirectedTreatment.

Propriedades removidas

As propriedades a seguir foram removidas.

Classe v11.0.0 Propriedade Observações
GADMediationAdConfiguration hasUserLocation Sem substituição.
userLatitude
userLongitude
userLocationAccuracyInMeters
childDirectedTreatment Use GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment.
GADResponseInfo adNetworkClassName Use adNetworkClassName de loadedAdNetworkResponseInfo.

Remoção de GADAdFormatUnknown

GADAdFormatUnknown foi removido sem substituição.

Mudanças na versão do SDK de registro

A versão 11.0.0 remove sdkVersion. Para registrar a versão do SDK dos anúncios para dispositivos móveis do Google, use versionNumber.

Versão 10.0.0

GADMobileAds.sharedInstance().sdkVersion

Versão 11.0.0

GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)

Mudanças no tratamento de erros do GADAdLoader

A partir da versão 11.0.0, o GADAdLoader não faz uma solicitação de anúncio se o delegate não estiver em conformidade com o protocolo de delegação dos tipos de anúncios solicitados. Antes, o erro ocorria depois que a solicitação de anúncio era feita.

Mudanças no comportamento de teste

Consulte a tabela que mostra as condições atualizadas para quando as propriedades a seguir retornam true.

Turma Propriedade
GADMediationAdConfiguration isTestRequest
GADCustomEventRequest isTesting
v10.0.0 v11.0.0
  • O dispositivo é declarado explicitamente como um dispositivo de teste em testDeviceIdentifiers.
  • O dispositivo é declarado explicitamente como um dispositivo de teste em testDeviceIdentifiers.
  • O dispositivo é um simulador.
  • O dispositivo é declarado explicitamente como um dispositivo de teste na interface da AdMob.

Migrar da v9 para a v10

Os anúncios param de ser veiculados no iOS 11

A versão 10.0.0 do SDK dos anúncios para dispositivos móveis do Google veicula anúncios apenas em dispositivos com iOS 12 ou mais recente.

Atualizar para a versão 10.0.0 do SDK dos anúncios para dispositivos móveis do Google não vai afetar seu app em dispositivos iOS 11 e iOS 10. No entanto, nenhum anúncio será veiculado nesses dispositivos.

Não há mais suporte para a criação com bitcode

Agora, é necessário desativar o bytecode nos seus apps para dispositivos móveis para integrar o SDK dos anúncios para dispositivos móveis do Google.

Tipos removidos

Tipo Observações
GADGender Sem substituição.
GADMRewardBasedVideoAdNetworkAdapterProtocol Todos os adaptadores de mediação com recompensa listados em Escolha as redes deixaram de usar esses protocolos há mais de um ano. Use o GADMediationAdapter para eventos personalizados e de mediação.
GADMRewardBasedVideoAdNetworkConnectorProtocol

Propriedades removidas

As propriedades a seguir são removidas sem substituição.

Classe v10.0.0 Propriedade
GADMediationAdRequest userBirthday
userGender
userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription
GADCustomEventRequest userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription

Migrar da v8 para a v9

Os anúncios param de ser veiculados no iOS 10

A versão mínima do iOS com suporte à versão 9.0.0 do SDK dos anúncios para dispositivos móveis do Google é o iOS 11.

A atualização para a versão 9.0.0 do SDK dos anúncios para dispositivos móveis do Google não vai afetar seu app em dispositivos iOS 10. No entanto, nenhum anúncio será veiculado nesses dispositivos.

Aplicação mais rigorosa dos controles da barra de status

A partir da versão 9.0.0, quando você apresentar anúncios em tela cheia, seu app precisa garantir que os anúncios possam controlar a apresentação da barra de status. Se você não fizer isso, uma mensagem de erro vai aparecer nos registros.

Dependendo do layout específico dos controladores de visualização no app, talvez não seja necessário fazer nenhuma mudança para garantir isso. Verifique se você precisa definir a propriedade childViewControllerForStatusBarHidden no rootViewController do seu anúncio.

O método adDidPresentFullScreenContent: foi renomeado para adWillPresentFullScreenContent:

Não há mudança de comportamento. O método delegado é invocado logo antes de o anúncio ser apresentado. Portanto, o novo nome do método reflete melhor a funcionalidade.

Remover a API Location Settings do GADRequest

- (void)setLocationWithLatitude:longitude:accuracy: foi excluído de GADRequest, porque os dados de local não são usados pelo Google para segmentar anúncios. Use APIs de terceiros para fornecer as informações às redes de publicidade de terceiros, se necessário.

Desatualização das interfaces de eventos personalizados

Os eventos personalizados permitem que os editores que usam a mediação da AdMob adicionem a mediação em hierarquia a uma rede de publicidade que não seja uma das redes de publicidade com suporte.

Todos os protocolos de eventos personalizados foram descontinuados. Em vez disso, use os protocolos GADMediationAdapter e GADMediationAdEventDelegate para ter as mesmas funcionalidades. Essa mudança melhora a clareza e permite que você crie eventos personalizados para anúncios premiados e anúncios interscroller que não estavam disponíveis anteriormente.

APIs

A tabela abaixo lista as APIs do adaptador de mediação correspondentes às APIs de eventos personalizados que devem ser usadas a partir da versão 9.0.0.

v8 v9
GADCustomEventBanner
GADCustomEventInterstitial
GADCustomEventNativeAd
GADMediationAdapter GADMediationBannerAd
GADMediationInterstitialAd
GADMediationInterscrollerAd
GADMediationRewardedAd
GADMediationNativeAd
delegate O delegante é retornado pelo gerenciador de conclusão de carregamento de cada função de carregamento da classe GADMediationAdapter.
-init -init
-requestBannerAd:parameter:label:request: -loadBannerForAdConfiguration:completionHandler:
-requestInterstitialAdWithParameter:label:request: -loadInterstitialForAdConfiguration:completionHandler:
-requestNativeAdWithParameter:request:adTypes:options:rootViewController: -loadNativeAdForAdConfiguration:completionHandler:
N/A -loadInterscrollerAdForAdConfiguration:completionHandler:
N/A -loadRewardedAdForAdConfiguration:completionHandler:
-presentFromRootViewController: -presentFromViewController:
-handlesUserClicks -handlesUserClicks
-handlesUserImpressions -handlesUserImpressions

Métodos delegados

A tabela abaixo lista os métodos de delegação de evento de anúncio de mediação correspondentes aos métodos de delegação de evento personalizado que devem ser usados a partir da versão 9.0.0.

v8 v9
GADCustomEventBannerDelegate
GADCustomEventInterstitialDelegate
GADCustomEventNativeAdDelegate
GADMediationAdEventDelegate GADMediationAd
-customEventBanner:didReceiveAd:
-customEventInterstitialDidReceiveAd:
O status de carregamento do anúncio é incluído no gerenciador de conclusão de carregamento de cada função de carregamento na classe GADMediationAdapter
-customEventBanner:didFailAd:
-customEventInterstitial:didFailAd:
-customEventBannerWasClicked:
-customEventInterstitialWasClicked:
-reportClick
-customEventBannerWillPresentModal:
-customEventInterstitialWillPresentModal:
-willPresentFullScreenView
-customEventBannerWillDismissModal:
-customEventInterstitialWillDismissModal:
-willDismissFullScreenView
-customEventBannerDidDismissModal:
-customEventInterstitialDidDismissModal:
-didDismissFullScreenView
-customEventBannerWillLeaveApplication:
-customEventInterstitialWillLeaveApplication:
-willBackgroundApplication
viewControllerForPresentingModalView -[GADMediationBannerAd view]

Outros métodos e constantes removidos/substituídos

Mudanças em método, constante ou propriedade
Constantes com prefixo kGAD- Removido. Use constantes com prefixo GAD-.
GADAdNetworkResponseInfo credentials foram removidos. Use adUnitMapping em vez disso.
GADCustomNativeAd O uso de mediaView em GADCustomNativeAd foi descontinuado. Em vez disso, use mediaContent.
APIs In-app purchases no GoogleMobileAds As APIs inAppPurchase em GoogleMobileAds foram removidas.

Migrar da v7 para a v8

A versão 8.0.0 do SDK dos anúncios para dispositivos móveis do Google apresenta algumas mudanças importantes, renomeações e remoções de APIs.

Atualizações da API de formato de tela cheia

A partir da versão 8.0.0, os anúncios intersticiais e premiados compartilham uma versão genérica de anúncios de tela cheia para aumentar a consistência. Essas novas APIs de anúncios em tela cheia têm duas principais diferenças das APIs de anúncios em tela cheia da versão 7:

  1. Método de classe estática load.

    A abordagem anterior para carregar/mostrar um anúncio de tela cheia é a seguinte:

    1. Crie uma instância de objeto de anúncio e mantenha uma referência a ela.
    2. Atribua um delegado que gerencie o carregamento e mostre callbacks.
    3. Carregue um anúncio.
    4. Verifique se o anúncio está carregado usando isReady.
    5. Mostre o anúncio.

    Na versão 8, a abordagem muda um pouco. Os callbacks de carregamento não são mais parte de um delegado. Em vez disso, elas são transmitidas para o método load como uma gerenciador de conclusão:

    1. Chamar um método de carregamento estático na classe de anúncio e fornecer uma conclusão de carregamento .
    2. Na chamada de retorno de conclusão do carregamento, mantenha uma referência ao anúncio carregado que retornados.
    3. Atribua um delegado que gerencie callbacks de exibição.
    4. Mostre o anúncio.

    A nova abordagem oferece estes benefícios:

    • Você nunca terá uma referência a um anúncio que não esteja carregado.
    • Não é preciso manter um objeto de anúncio enquanto ele é carregado.
  2. Eventos de anúncio consistentes.

    Tipo de evento API existente API v8
    Eventos de carregamento GADInterstitialDelegate ou GADRewardedAdDelegate GADInterstitialAdLoadCompletionHandler ou GADRewardedAdLoadCompletionHandler
    Eventos de apresentação GADFullScreenContentDelegate

    Anteriormente, para monitorar eventos de anúncio, você precisava registrar uma classe que implementa GADInterstitialDelegate para uma propriedade delegada de um intersticial ou registrar uma classe que implementa GADRewardedAdDelegate para uma propriedade delegada de um anúncio premiado, dependendo do formato que você está usando. Esse mesmo delegado tinha métodos relacionados ao carregamento da apresentação de um anúncio.

    Na versão 8, os eventos de carregamento e de apresentação são separados. Agora é possível registrar um GADFullScreenContentDelegate a qualquer momento antes de mostrar um anúncio, em vez de ser obrigado a definir um único delegado antes de carregar o anúncio. Eventos de carregamento de anúncios, que são específicos para cada , vá para um único gerenciador de conclusão de carregamento transmitido no método de carregamento.

Intersticial

Carregar anúncio

Os snippets de código abaixo mostram como carregar um anúncio intersticial e detectar quando o carregamento do anúncio ocorre ou falha.

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;
  }];
}

Anúncio de display

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 anúncio de apresentação

Os snippets de código abaixo mostram como tratar callbacks para quando o anúncio apresenta (com ou sem sucesso) e quando é dispensado.

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.");
}

Premiado

Carregar anúncio

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;
}

Anúncio de display e identificador do prêmio

Nos anúncios premiados, é necessário gerenciar o evento quando um usuário ganha uma recompensa. Com para a versão 7 da API GADRewardedAd, você implementa rewardedAd:userDidEarnReward: como parte do protocolo GADRewardedAdDelegate. Na versão 8, você implementa o GADUserDidEarnRewardHandler para apresentar o anúncio.

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 anúncio de apresentação

Com a API GADRewardedAd, você transmite um GADRewardedAdDelegate ao método. que apresenta o anúncio. Com a API GADRewardedAd, você define uma GADFullscreenContentDelegate como uma propriedade no anúncio antes de apresentar o anúncio.

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.");
}

Remoção da API GAD PerformanceBasedVideoAd legada

As mais novas GADRewardedAd A API foi lançada em março de 2019 e tem sido o prêmio preferencial há mais de 18 meses. Ele teve mais melhorias em comparação com a versão legada API GADRewardedBasedVideoAd, incluindo a capacidade de carregar mais de uma anúncio premiado por vez.

A API GADRewardedBasedVideoAd legada foi removida na versão 8.0.0 do SDK.

Suspensão de uso do banner inteligente em favor do banner adaptativo

Os anúncios de banner inteligente foram descontinuados em favor do banner adaptativo anúncios. Banners adaptativos oferecem desempenho superior e mais flexibilidade em definindo a largura do anúncio. Se você preferir continuar usando banners de largura total, isso pode ainda é possível usar o banner adaptativo, conforme mostrado no snippet de código a seguir:

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

Sair da remoção do callback do aplicativo

O callback willLeaveApplication para todos os formatos de anúncio foi removida em favor do applicationDidEnterBackground: e sceneDidEnterBackground: métodos. Com as APIs no nível do SO, você recebe notificações sempre que os usuários saem do app, seja qual for seja devido ou não a uma interação com o anúncio.

O callback willLeaveApplication não foi criado para ser um gerenciador de cliques no anúncio, e depender desse callback para informar os cliques não para produzir uma métrica precisa. Por exemplo, um clique em "Opções de anúncios" ícone que iniciou um navegador externo invocou o retorno de chamada, mas não contou um clicar.

Renomeações de classes

A tabela abaixo lista nomes de classes específicos que foram alterados ou removidos em versão 8. Resumindo:

  • Todas as classes relacionadas a GADUnifiedNativeAd foram renomeadas para GADNativeAd.
  • GADRewardBasedVideoAd, GADNativeExpressAdView e GADInstreamAd têm tenha sido removido.
  • Todas as classes com o prefixo DFP foram substituídas por um prefixo GAM.
Classe v7.68.0 Classe v8.0.0
DFPBannerView GAMBannerView
DFPBannerViewOptions GAMBannerViewOptions
DFPInterstitial GAMInterstitialAd
DFPRequest GAMRequest
GADRequestError NSError
GADUnifiedNativeAdView GADNativeAdView
GADunUnificado GADNativeAd
GADUnifiedNativeAdAssetIdentifiers GADNativeAdAssetIdentifiers
GADUnifiedNativeAdDelegate GADNativeAdDelegate
GADUnifiedNativeAdUnconfirmedClickDelegate GADNativeAdUnconfirmedClickDelegate
GADNativeCustomTemplateAd GADCustomNativeAd
GADNativeCustomTemplateAdLoaderDelegate GADCustomNativeAdLoaderDelegate
GADNativeAdDelegate GADCustomNativeAdDelegate
GADInAppPurchase Removido
GADInterstitial GADInterstitialAd
GADNativeExpressAdView Removido
GADRewardBasedVideoAd Removido
GADInstreamAd Removido
GADInstreamAdView Removido

Métodos removidos/substituídos

A tabela abaixo lista as mudanças específicas na versão 8. Resumindo:

  • Os métodos e as propriedades descontinuados foram removidos.
  • Os métodos delegados -willLeaveApplication: foram removidos para todos os formatos.
  • O nome da classe da rede de publicidade foi movido para a propriedade GADResponseInfo.
  • O identificador do dispositivo de teste foi movido para GADRequestConfiguration .
Classe v7.68.0 API v7.68.0 API v8.0.0 Observações
GADMobileAds +configureWithApplicationID: -startWithCompletionHandler: O ID do app agora está definido em Info.plist.
+disableAutomatedInAppPurchaseReporting -disableAutomatedInAppPurchaseReporting
+disableSDKCrashReporting -disableSDKCrashReporting
GADRequest testDevices GADRequestConfiguration.testdeviceidentifiers A propriedade testDeviceIdentifiers se aplica a todas as solicitações de anúncios. Já a antiga propriedade testDevices foi definida por solicitação.
gênero Removido
aniversário Removido
+sdkVersion GADMobileAds.sharedInstance.sdkVersion
-setBirthdayWithMonth:day:year: Removido
-setLocationWithDescription: -setLocationWithLatitude:longitude:accuracy:
-tagForChildDirectedTreatment: [GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment]
GADErrorCode kGADError* GADError* O prefixo k é descartado de todas as constantes de código de erro.
GADBannerView hasAutoRefreshed autoloadEnabled
inAppPurchaseDelegate Removido
mediatedAdView Removido
adNetworkClassName responseInfo.adNetworkClassName
DFPBannerView -setValidAdSizesWithSizes: -setValidAdSizes:
DFPBannerViewOptions -adSizeDelegate Removido
GADBannerViewDelegate -adViewDidReceiveAd: -bannerViewDidReceiveAd:
-adView:didFailToReceiveAdWithError: -bannerView:didFailToReceiveAdWithError:
-adViewWillPresentScreen: -bannerViewWillPresentScreen:
-adViewWillDismissScreen: -bannerViewWillDismissScreen:
-adViewDidDismissScreen: -bannerViewDidDismissScreen:
-adViewWillLeaveApplication: Removido
GADNativeCustomTemplateAd templateID GADCustomNativeAd.formatID
-performClickOnAssetWithKey:customClickHandler: -performClickOnAssetWithKey:
GADNativeAdImageAdLoaderOptions preferredImageOrientation GADNativeAdMediaAdOptions.mediaAspectRatio
GADInterstitial inAppPurchaseDelegate Removido
isReady Removido Em vez disso, use canPresentFromRootViewController:error:.
hasBeenUsed Removido
-init -initWithAdUnitID:
-setAdUnitID: -initWithAdUnitID:
adNetworkClassName responseInfo.adNetworkClassName
-interstitialWillLeaveApplication: Removido
GADunUnificado videoController mediaContent.videoController
adNetworkClassName responseInfo.adNetworkClassName