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 deve 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 compatível do Xcode aumentou para 16.0.
Suporte para nomenclatura 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 do 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 paraAdManager
. - O prefixo
GADM
foi renomeado paraMediation
.
corrigir erros.
A melhor forma de resolver os erros resultantes dessas mudanças é fazer uma correção com o 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 exemplo a seguir define o namespace da classe Request
do SDK dos anúncios para dispositivos móveis do Google:
import GoogleMobileAds
...
var request: GoogleMobileAds.Request?
Lista detalhada de mudanças no 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 mudo 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 adaptativos inline
Para otimizar o uso do espaço, os anúncios adaptáveis inline não ocupam espaço
no frame inicialmente. 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 |
Agora os erros 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 de extras
- Não é mais possível transmitir a chave
max_ad_content_rating
paraadditionalParameters
. Para definir uma classificação máxima do conteúdo do anúncio, consulte a filtragem de conteúdo do anúncio.
Migrar da v10 para a v11
Destino mínimo de implantação
A meta mínima de implantação foi aumentada para o iOS 12.
Versão mínima do Xcode
A versão mínima compatível do Xcode 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 que executam o iOS 13 e versões mais recentes.
A dependência do GoogleAppMeasurement foi removida
Na versão 11.0.0, a dependência de
GoogleAppMeasurement
foi
removida. Essa dependência que alimentava 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 app.
Mudanças na apresentação de anúncios em tela cheia
As seguintes mudanças 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:
pode ser nulo. Se nil for transmitido, o anúncio será
apresentado do controlador de visualização superior na hierarquia de controladores de visualização.
Métodos removidos
Os seguintes métodos foram removidos.
Tipo v11.0.0 | Método | Observações |
---|---|---|
GADAppOpenAd | load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation) |
Use load(withAdUnitID adUnitID: String, request: GADRequest?) . |
GADMediationBannerAdEventDelegate | willBackgroundApplication() |
Nenhuma substituição. |
GADMediationInterstitialAdEventDelegate | willBackgroundApplication() |
Nenhuma substituição. |
GADMediationNativeAdEventDelegate | willBackgroundApplication() |
Nenhuma substituição. |
GADMediationRewardedAdEventDelegate | didRewardUser(with reward: GADAdReward) |
Use didRewardUser() . |
GADMediatedUnifiedNativeAdNotificationSource | mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) |
Nenhuma 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 seguintes propriedades foram removidas.
Classe v11.0.0 | Propriedade | Observações |
---|---|---|
GADMediationAdConfiguration | hasUserLocation | Nenhuma substituição. |
userLatitude | ||
userLongitude | ||
userLocationAccuracyInMeters | ||
childDirectedTreatment | Use GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment . |
|
GADResponseInfo | adNetworkClassName | Use adNetworkClassName de loadedAdNetworkResponseInfo . |
GADAdFormatUnknown removido
GADAdFormatUnknown
foi removido sem substituição.
Mudanças na versão do SDK de geração de registros
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
em vez disso.
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 delegado dos tipos de anúncios solicitados. Antes, ele falhava 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 seguintes propriedades retornam true
.
Turma | Propriedade |
---|---|
GADMediationAdConfiguration | isTestRequest |
GADCustomEventRequest | isTesting |
v10.0.0 | v11.0.0 |
|
|
Migrar da v9 para a v10
Os anúncios param de ser veiculados no iOS 11
O SDK dos anúncios para dispositivos móveis do Google versão 10.0.0 veicula anúncios apenas em dispositivos com iOS 12 e versões mais recentes.
A atualização para a versão 10.0.0 do SDK dos anúncios para dispositivos móveis do Google não vai interromper o funcionamento do app em dispositivos iOS 11 e iOS 10, mas nenhum anúncio será veiculado nesses dispositivos.
Não há mais suporte para a criação com bitcode
Agora é necessário desativar o bitcode nos apps para dispositivos móveis para integrar o SDK dos anúncios para dispositivos móveis do Google.
Tipos removidos
Tipo | Observações |
---|---|
GADGender | Nenhuma substituição. |
GADMRewardBasedVideoAdNetworkAdapterProtocol | Todos os adaptadores de mediação premiada listados em Escolher redes pararam de usar esses protocolos há mais de um ano. Use GADMediationAdapter para mediação e eventos personalizados. |
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 deixam de ser veiculados no iOS 10
A versão mínima do iOS compatível com o SDK dos anúncios para dispositivos móveis do Google 9.0.0 é 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 interromper o funcionamento do app em dispositivos iOS 10, mas 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 formato de 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 seu app, talvez não seja necessário fazer mudanças para garantir isso. Verifique se é necessário definir a propriedade
childViewControllerForStatusBarHidden
no rootViewController
do anúncio.
Renomeie adDidPresentFullScreenContent: para adWillPresentFullScreenContent:
Não há mudanças de comportamento. O método delegado é invocado logo antes da apresentação do anúncio. Por isso, o novo nome reflete melhor a funcionalidade.
Remover a API Location Settings de 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.
Descontinuação das interfaces de eventos personalizados
Com os eventos personalizados, os editores que usam a mediação da AdMob podem adicionar a mediação em hierarquia para uma rede de anúncios que não está entre as redes de anúncios compatíveis.
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 criar eventos personalizados para anúncios premiados e intersticiais, que não estavam disponíveis antes.
APIs
A tabela abaixo lista as APIs de 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 delegado é retornado pelo gerenciador de conclusão de carregamento de cada função de carregamento
da classe 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 delegação
A tabela abaixo lista os métodos delegados de eventos de anúncios de mediação correspondentes aos métodos delegados de eventos personalizados 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 carga do anúncio é incluído no manipulador de conclusão de carga de
cada função de carga na classe GADMediationAdapter .
|
|
-customEventBanner:didFailAd: -customEventInterstitial:didFailAd:
|
||
-customEventBannerWasClicked: -customEventInterstitialWasClicked:
|
-reportClick |
|
-customEventBannerWill -customEventInterstitialWill
|
-willPresentFullScreenView |
|
-customEventBannerWill -customEventInterstitialWill
|
-willDismissFullScreenView |
|
-customEventBannerDid -customEventInterstitialDid
|
-didDismissFullScreenView |
|
-customEventBannerWill -customEventInterstitialWill
|
-willBackgroundApplication |
|
viewControllerFor |
-[GADMediationBannerAd view] |
Outros métodos e constantes removidos/substituídos
Mudanças no método, na constante ou na propriedade | |
---|---|
Constantes com prefixo kGAD-
|
Removido. Use constantes com o 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 Purchase em 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, além da mudança de nome e da remoção 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 um estilo genérico de anúncio em tela cheia para mais consistência. Essas novas APIs de anúncios em tela cheia têm duas distinções principais das APIs de anúncios em tela cheia da versão 7:
Método de classe estático
load
.A abordagem anterior para carregar/mostrar um anúncio em tela cheia é a seguinte:
- Crie uma instância de objeto de anúncio e mantenha uma referência a ela.
- Atribua um delegado que processe callbacks de carregamento e exibição.
- Carregue um anúncio.
- Verifique se o anúncio foi carregado usando
isReady
. - Mostre o anúncio.
Na versão 8, a abordagem muda um pouco. Os callbacks de carregamento não fazem mais parte de um delegado. Em vez disso, eles são transmitidos para o método
load
como um manipulador de conclusão:- Chame um método de carregamento estático na classe de anúncio e forneça um gerenciador de conclusão de carregamento.
- No callback de conclusão do carregamento, mantenha uma referência ao anúncio carregado que é retornado.
- Atribua um delegado que processe callbacks de exibição.
- Mostre o anúncio.
A nova abordagem oferece estes benefícios:
- Você nunca terá uma referência a um anúncio que não foi carregado.
- Não é necessário manter um objeto de anúncio enquanto ele está sendo carregado.
Eventos de anúncio consistentes.
Tipo de evento API atual API v8 Eventos de carregamento GADInterstitialDelegate
ouGADRewardedAdDelegate
GADInterstitialAdLoadCompletionHandler
ouGADRewardedAdLoadCompletionHandler
Eventos de apresentação GADFullScreenContentDelegate
Antes, para detectar eventos de anúncio, você registrava uma classe que implementava o protocolo
GADInterstitialDelegate
em uma propriedade delegada de um intersticial ou registrava uma classe que implementava o protocoloGADRewardedAdDelegate
em uma propriedade delegada de um anúncio premiado, dependendo do formato usado. Esse mesmo delegado tinha métodos relacionados ao ciclo de vida de carregamento e apresentação de um anúncio.Na versão 8, os eventos de carregamento e apresentação são separados. Agora você pode registrar um
GADFullScreenContentDelegate
a qualquer momento antes de veicular um anúncio, em vez de precisar definir um único delegado antes de carregar o anúncio. Os eventos de carregamento de anúncios, que são específicos para cada formato, passam 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 eventos quando o anúncio é carregado ou não.
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 processar callbacks quando o anúncio é apresentado (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; }
Mostrar anúncio de display e processar recompensa
Os anúncios premiados exigem que você processe o evento quando um usuário ganha uma recompensa. Com 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 um GADFullscreenContentDelegate
como uma propriedade no anúncio antes de apresentá-lo.
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 GADRewardedBasedVideoAd legada
A API
GADRewardedAd
mais recente foi lançada em março de 2019 e é a API de
recompensa preferida há mais de 18 meses. Ela teve mais melhorias em comparação com a API
GADRewardedBasedVideoAd
legada, incluindo a capacidade de carregar mais de um
anúncio premiado por vez.
A API legada GADRewardedBasedVideoAd
foi removida na versão 8.0.0 do SDK.
Descontinuação do banner inteligente em favor do banner adaptativo
Os anúncios de banner inteligente foram descontinuados em favor dos anúncios de banner adaptativo. Os banners adaptativos oferecem performance superior e mais flexibilidade na definição da largura do anúncio. Se você preferir continuar usando banners de largura total, isso ainda poderá ser feito com 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
Remoção de callback de saída do aplicativo
O callback willLeaveApplication
para todos os formatos de anúncio foi removido em favor dos métodos applicationDidEnterBackground:
e sceneDidEnterBackground:
. Usar APIs no nível do SO para notificar sempre que os usuários saírem do app, independente de
ser devido a uma interação com um anúncio ou não.
O callback willLeaveApplication
nunca foi projetado para ser um gerenciador de cliques em anúncios, e confiar nele para informar cliques não produzia uma métrica precisa. Por exemplo, um clique no ícone
Opções de anúncio que iniciou um navegador externo invocou o callback, mas não contou um
clique.
Renomeação de classes
A tabela abaixo lista nomes de classes específicos que foram alterados ou removidos na versão 8. Resumindo:
- Todas as classes relacionadas a
GADUnifiedNativeAd
foram renomeadas comoGADNativeAd
. GADRewardBasedVideoAd
,GADNativeExpressAdView
eGADInstreamAd
foram removidos.- Todas as classes com o prefixo
DFP
foram substituídas por um prefixoGAM
.
Classe v7.68.0 | Classe 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 | 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:
- Métodos e propriedades descontinuados foram removidos.
- Os métodos delegados
-willLeaveApplication:
foram removidos de 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 a propriedade
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. |
+disableAutomatedInApp |
-disableAutomatedInApp |
||
+disableSDKCrashReporting | -disableSDKCrashReporting | ||
GADRequest | testDevices | GADRequestConfiguration |
A propriedade "testDeviceIdentifiers" se aplica a todas as solicitações de anúncio, enquanto a antiga propriedade "testDevices" era definida por solicitação. |
gênero | Removido | ||
aniversário | Removido | ||
+sdkVersion | GADMobileAds.sharedInstance |
||
-setBirthday |
Removido | ||
-setLocationWithDescription: | -setLocationWith |
||
-tagForChildDirectedTreatment: | [GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment] | ||
GADErrorCode | kGADError* | GADError* | O prefixo k é removido de todas as constantes de código de erro.
|
GADBannerView | hasAutoRefreshed | autoloadEnabled | |
inAppPurchaseDelegate | Removido | ||
mediatedAdView | Removido | ||
adNetworkClassName | responseInfo |
||
DFPBannerView | -setValidAdSizesWithSizes: | -setValidAdSizes: | |
DFPBannerViewOptions | -adSizeDelegate | Removido | |
GADBannerViewDelegate | -adViewDidReceiveAd: | -bannerViewDidReceiveAd: | |
-adView:didFailToReceive |
-bannerView:didFailToReceive |
||
-adViewWillPresentScreen: | -bannerViewWillPresentScreen: | ||
-adViewWillDismissScreen: | -bannerViewWillDismissScreen: | ||
-adViewDidDismissScreen: | -bannerViewDidDismissScreen: | ||
-adViewWillLeaveApplication: | Removido | ||
GADNativeCustomTemplateAd | templateID | GADCustomNativeAd.formatID | |
-performClickOnAssetWithKey: |
-performClickOnAssetWithKey: | ||
GADNativeAdImageAd |
preferredImageOrientation | GADNativeAdMediaAdOptions |
|
GADInterstitial | inAppPurchaseDelegate | Removido | |
isReady | Removido | Use canPresentFrom |
|
hasBeenUsed | Removido | ||
-init | -initWithAdUnitID: | ||
-setAdUnitID: | -initWithAdUnitID: | ||
adNetworkClassName | responseInfo |
||
-interstitialWill |
Removido | ||
GADUnifiedNativeAd | videoController | mediaContent.videoController | |
adNetworkClassName | responseInfo |