SDK 遷移

本頁面說明如何遷移 iOS 版 Google Mobile Ads SDK 的目前和先前版本。12.0.0 版預計於 2025 年 2 月發布。

從 SDK 第 11 版遷移至第 12 版

升級至 Xcode 16.0

最低支援的 Xcode 版本已提高至 16.0。

支援 Swift 命名

12.0.0 版的變更符合 Swift API 設計指南的命名慣例。這些變更只會影響 Swift。Objective-C API 的命名方式沒有任何變更。

變更類別前置字元

類別前置字元已進行下列變更:

  • 已移除所有類型名稱的 GAD 前置字元。
  • 已將 GAM 前置字串重新命名為 AdManager
  • 已將 GADM 前置字串重新命名為 Mediation

修正錯誤

如要解決因這些變更而導致的錯誤,最佳方法是進行「修正」更正

解決命名衝突

如要解決命名衝突,請使用模組提供的命名空間。舉例來說,GADRequest 現在稱為 Request。下列範例會將 Google Mobile Ads SDK Request 類別命名空間化:

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

Swift 變更的詳細清單

下表列出 Swift API 的異動:

11 版 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
中介服務
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
即時出價
GADRTBAdapter RTBAdapter
GADRTBMediationSignalsConfiguration RTBMediationSignalsConfiguration
GADRTBRequestParameters RTBRequestParameters

常數

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

屬性

類型 11 版 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

函式

類型 11 版 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:)
中介服務
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:)

控制影片靜音狀態的 API 異動

GADVideoController 上的 isMuted 屬性和 setMute: 方法會替換為 muted 屬性。

內嵌自動調整廣告的變更

為盡量節省空間,自動調整式內嵌廣告一開始不會佔用影格空間。現在使用內嵌自動調整大小的廣告呼叫 CGSizeFromGADAdSize(_:) 時,系統會傳回 0 高度,直到 Google Mobile Ads SDK 傳回廣告為止。

已移除自訂搜尋廣告

以下類別已移除,且沒有任何更換內容:

  • GADDynamicHeightSearchBannerView
  • GADDynamicHeightSearchRequest
  • GADSearchBannerView

錯誤代碼異動

下列錯誤代碼已變更:

類別 附註
GADErrorMediationNoFill 錯誤現在會以 GADErrorNoFill 形式傳回。
GADErrorReceivedInvalidResponse 已改為 GADErrorReceivedInvalidAdString

已移除 GADSimulatorID

已移除 GADSimulatorID。模擬器預設為測試模式。

自訂指定目標異動

GADRequest 上的 customTargeting 字典現在使用 Any,而非 String 做為值型別。這樣一來,您就能將數值傳遞至 API。

變更加購內容參數

從 v10 遷移至 v11

最低部署目標

最低部署目標已提高至 iOS 12。

最低 Xcode 版本

最低支援的 Xcode 版本已提高至 15.1。

廣告停止在 iOS 12 上放送

Google Mobile Ads SDK 11.0.0 版只會在執行 iOS 13 以上版本的裝置上放送廣告。

移除 GoogleAppMeasurement 依附元件

在 11.0.0 版中,已移除對 GoogleAppMeasurement 的依附元件。這項依附元件是 AdMob 中使用者指標切換鈕的運作基礎,將於 2024 年初停用。如要繼續在 AdMob 中收集使用者指標,請將 AdMob 應用程式連結至 Firebase,並在應用程式中整合 Google Analytics for Firebase SDK。

全螢幕廣告呈現方式異動

下列變更會影響各種廣告格式:

  • 應用程式開啟頁面廣告
  • 插頁式
  • 已獲得獎勵
  • 插頁式獎勵廣告

-canPresentFromRootViewController:error:-presentFromRootViewController: 中的檢視畫面控制器參數可為空值。如果傳遞 nil,系統會從檢視控制器階層中的最頂端檢視控制器顯示廣告。

已移除方法

下列方法已移除。

11.0.0 版類型 方法 附註
GADAppOpenAd load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation) 請改用 load(withAdUnitID adUnitID: String, request: GADRequest?)
GADMediationBannerAdEventDelegate willBackgroundApplication() 沒有替代方案。
GADMediationInterstitialAdEventDelegate willBackgroundApplication() 沒有替代方案。
GADMediationNativeAdEventDelegate willBackgroundApplication() 沒有替代方案。
GADMediationRewardedAdEventDelegate didRewardUser(with reward: GADAdReward) 請改用 didRewardUser()
GADMediatedUnifiedNativeAdNotificationSource mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd) 沒有替代方案。
GADRequestConfiguration setSameAppKeyEnabled(_ enabled: Bool) 請改用 setPublisherFirstPartyIDEnabled(_ enabled: Bool)
tagForUnderAge(ofConsent underAgeOfConsent: Bool) 請改用 tagForUnderAgeOfConsent 屬性。
tag(forChildDirectedTreatment childDirectedTreatment: Bool) 請改用 tagForChildDirectedTreatment 屬性。

已移除房源

下列屬性已移除。

11.0.0 版類別 屬性 附註
GADMediationAdConfiguration hasUserLocation 沒有替代方案。
userLatitude
userLongitude
userLocationAccuracyInMeters
childDirectedTreatment 請改用 GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment
GADResponseInfo adNetworkClassName 請改用 loadedAdNetworkResponseInfo 中的 adNetworkClassName

已移除 GADAdFormatUnknown

移除了 GADAdFormatUnknown,且沒有任何更換內容。

記錄 SDK 版本的方式異動

11.0.0 版已移除 sdkVersion。如要記錄 Google Mobile Ads SDK 版本,請改用 versionNumber

10.0.0 版

GADMobileAds.sharedInstance().sdkVersion

11.0.0 版

GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)

GADAdLoader 錯誤處理方式異動

從 11.0.0 版開始,如果 GADAdLoaderdelegate 不符合所要求廣告類型的委派通訊協定,就不會發出廣告請求。先前,廣告請求發出後會失敗。

測試行為異動

請參閱下表,瞭解下列屬性傳回 true 時的更新條件。

類別 屬性
GADMediationAdConfiguration isTestRequest
GADCustomEventRequest isTesting
v10.0.0 v11.0.0
  • 裝置在 testDeviceIdentifiers 中明確宣告為測試裝置。
  • 裝置在 testDeviceIdentifiers 中明確宣告為測試裝置。
  • 裝置為模擬器。
  • 在 AdMob 使用者介面中,裝置已明確宣告為測試裝置。

從第 9 版遷移至第 10 版

廣告停止在 iOS 11 上放送

Google Mobile Ads SDK 10.0.0 版只會在搭載 iOS 12 以上版本的裝置上放送廣告。

升級至 Google Mobile Ads SDK 10.0.0 版後,應用程式在 iOS 11 和 iOS 10 裝置上不會無法運作,但這些裝置不會放送任何廣告。

系統不再支援使用位元碼建構

如要整合 Google Mobile Ads SDK,現在必須在行動應用程式中停用位元碼。

已移除類型

類型 附註
GADGender 沒有替代方案。
GADMRewardBasedVideoAdNetworkAdapterProtocol 「選擇聯播網」頁面列出的所有中介服務獎勵廣告介面卡,都已停止使用這些通訊協定超過一年。使用 GADMediationAdapter 進行中介服務和自訂事件。
GADMRewardBasedVideoAdNetworkConnectorProtocol

已移除房源

下列屬性已移除,且沒有替代屬性。

v10.0.0 類別 屬性
GADMediationAdRequest userBirthday
userGender
userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription
GADCustomEventRequest userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription

從第 8 版遷移至第 9 版

iOS 10 停止放送廣告

Google Mobile Ads SDK 9.0.0 版支援的最低 iOS 版本為 iOS 11。

升級至 Google Mobile Ads SDK 9.0.0 版後,應用程式在 iOS 10 裝置上仍可正常運作,但不會在這些裝置上放送任何廣告。

更嚴格地強制執行狀態列控制項

從 9.0.0 版開始,應用程式顯示全螢幕格式廣告時,應確保廣告可控制狀態列的顯示方式。如果未執行這項操作,記錄中會顯示錯誤訊息。

視應用程式中檢視畫面控制器的特定版面配置而定,您可能不需要進行任何變更,即可確保這點。請考慮是否需要在廣告的 rootViewController 上設定 childViewControllerForStatusBarHidden 屬性。

將 adDidPresentFullScreenContent: 重新命名為 adWillPresentFullScreenContent:

行為沒有任何變更。系統會在即將顯示廣告前呼叫委派方法,因此新方法名稱更能反映其功能。

移除 GADRequest 的位置資訊設定 API

- (void)setLocationWithLatitude:longitude:accuracy:已從 GADRequest 中刪除,因為 Google 不會使用位置資料指定廣告。視需要使用第三方 API,向第三方廣告聯播網提供資訊。

自訂事件介面已淘汰

自訂事件可讓使用 AdMob 中介服務的發布商,為非支援的廣告聯播網新增刊登序列中介服務。

所有自訂事件通訊協定都已淘汰。請改用現有的 GADMediationAdapterGADMediationAdEventDelegate 通訊協定,達到相同的功能。這項變更可提升清楚度,並讓您為先前無法使用的插頁式獎勵廣告和捲動間廣告建立自訂事件。

API

下表列出對應的中介服務介面卡 API,以及從 9.0.0 版開始應使用的自訂事件 API。

v8 v9
GADCustomEventBanner
GADCustomEventInterstitial
GADCustomEventNativeAd
GADMediationAdapter GADMediationBannerAd
GADMediationInterstitialAd
GADMediationInterscrollerAd
GADMediationRewardedAd
GADMediationNativeAd
delegate 每個 GADMediationAdapter 類別的載入函式載入完成處理常式都會傳回委派
-init -init
-requestBannerAd:parameter:label:request: -loadBannerForAdConfiguration:completionHandler:
-requestInterstitialAdWithParameter:label:request: -loadInterstitialForAdConfiguration:completionHandler:
-requestNativeAdWithParameter:request:adTypes:options:rootViewController: -loadNativeAdForAdConfiguration:completionHandler:
-loadInterscrollerAdForAdConfiguration:completionHandler:
-loadRewardedAdForAdConfiguration:completionHandler:
-presentFromRootViewController: -presentFromViewController:
-handlesUserClicks -handlesUserClicks
-handlesUserImpressions -handlesUserImpressions

委派方法

下表列出對應的中介服務廣告事件委派方法,以及從 9.0.0 版開始應使用的自訂事件委派方法。

v8 v9
GADCustomEventBannerDelegate
GADCustomEventInterstitialDelegate
GADCustomEventNativeAdDelegate
GADMediationAdEventDelegate GADMediationAd
-customEventBanner:didReceiveAd:
-customEventInterstitialDidReceiveAd:
廣告載入狀態會納入 GADMediationAdapter 類別中每個載入函式的載入完成處理常式。
-customEventBanner:didFailAd:
-customEventInterstitial:didFailAd:
-customEventBannerWasClicked:
-customEventInterstitialWasClicked:
-reportClick
-customEventBannerWillPresentModal:
-customEventInterstitialWillPresentModal:
-willPresentFullScreenView
-customEventBannerWillDismissModal:
-customEventInterstitialWillDismissModal:
-willDismissFullScreenView
-customEventBannerDidDismissModal:
-customEventInterstitialDidDismissModal:
-didDismissFullScreenView
-customEventBannerWillLeaveApplication:
-customEventInterstitialWillLeaveApplication:
-willBackgroundApplication
viewControllerForPresentingModalView -[GADMediationBannerAd view]

其他已移除/取代的方法和常數

方法、常數或屬性變更
kGAD- 前置常數 已移除。使用以 GAD- 為前置字元的常數。
GADAdNetworkResponseInfo 已移除 credentials。請改用 adUnitMapping
GADCustomNativeAd GADCustomNativeAd 中的 mediaView 已淘汰。 請改用 mediaContent
GoogleMobileAds 中的應用程式內購 API 已移除 GoogleMobileAds 中的 inAppPurchase API。

從第 7 版遷移至第 8 版

Google Mobile Ads SDK 8.0.0 版導入了幾項重大變更,也重新命名並移除了一些 API。

全螢幕格式 API 更新

從 8.0.0 版開始,中插廣告和獎勵廣告會共用一般全螢幕廣告樣式,以提高一致性。與第 7 版全螢幕廣告 API 相比,這些新的全螢幕廣告 API 有兩項主要差異:

  1. 靜態類別方法 load

    先前載入/顯示全螢幕廣告的方法如下:

    1. 建立廣告物件例項,並保留對該例項的參照。
    2. 指派處理載入和顯示回呼的委派。
    3. 載入廣告。
    4. 使用 isReady 檢查廣告是否已載入。
    5. 顯示廣告。

    在第 8 版中,方法略有不同。載入回呼不再是委派的一部分。而是以完成處理常式的形式傳遞至 load 方法:

    1. 在廣告類別上呼叫靜態載入方法,並提供載入完成處理常式。
    2. 在載入完成回呼中,保留對傳回的已載入廣告的參照。
    3. 指派處理顯示回呼的委派。
    4. 顯示廣告。

    新方法具備下列優點:

    • 您絕不會參照未載入的廣告。
    • 載入廣告物件時,您不必保留該物件。
  2. 廣告事件一致性。

    事件類型 現有 API v8 API
    載入活動 GADInterstitialDelegateGADRewardedAdDelegate GADInterstitialAdLoadCompletionHandlerGADRewardedAdLoadCompletionHandler
    簡報事件 GADFullScreenContentDelegate

    先前,如要監聽任何廣告事件,您必須註冊實作 GADInterstitialDelegate 通訊協定的類別,並將該類別指派給中繼廣告的委派屬性,或是註冊實作 GADRewardedAdDelegate 通訊協定的類別,並將該類別指派給獎勵廣告的委派屬性,視您使用的格式而定。這個委派項目同時具有與廣告載入和顯示生命週期相關的方法。

    在第 8 版中,載入和呈現事件是分開的。您現在可以在顯示廣告前隨時註冊 GADFullScreenContentDelegate,不必在載入廣告前設定單一委派。廣告載入事件 (各格式專屬) 會移至載入方法中傳遞的單一載入完成處理常式。

插頁式

載入廣告

下列程式碼片段說明如何載入插頁式廣告,以及在廣告載入成功或失敗時監聽事件。

第 7 版

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

多媒體廣告

第 7 版

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

簡報廣告事件

下列程式碼片段說明如何處理廣告顯示 (成功或失敗) 和關閉時的回呼。

第 7 版

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

已獲得獎勵

載入廣告

第 7 版

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

顯示廣告並處理獎勵

獎勵廣告需要您處理使用者獲得獎勵時的事件。使用 GADRewardedAd API 第 7 版時,您會實作 rewardedAd:userDidEarnReward:,做為 GADRewardedAdDelegate 通訊協定的一部分。如果是第 8 版,您需要實作 GADUserDidEarnRewardHandler,才能顯示廣告。

第 7 版

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

簡報廣告事件

使用 GADRewardedAd API 時,您會將 GADRewardedAdDelegate 傳遞至顯示廣告的方法。使用 GADRewardedAd API 時,您會在顯示廣告前,將 GADFullscreenContentDelegate 設為廣告的屬性。

第 7 版

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

移除舊版 GADRewardedBasedVideoAd API

新版 GADRewardedAd API 最早在 2019 年 3 月推出,且已成為偏好的獎勵 API 超過 18 個月。與舊版 GADRewardedBasedVideoAd API 相比,這項 API 經過更多強化,包括一次載入多個買家出價的功能。

SDK 8.0.0 版已移除舊版 GADRewardedBasedVideoAd API。

智慧型橫幅廣告將淘汰,改用自動調整橫幅廣告

智慧型橫幅廣告已淘汰,建議改用自動調整橫幅廣告。自動調整橫幅廣告的成效更出色,且設定廣告寬度時更具彈性。如果您偏好繼續使用全寬橫幅,仍可使用自動調整橫幅,如下列程式碼片段所示:

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

離開應用程式回呼移除作業

為配合 applicationDidEnterBackground:sceneDidEnterBackground: 方法,所有廣告格式的 willLeaveApplication 回呼都已移除。無論使用者離開應用程式的原因是否與廣告互動有關,作業系統層級的 API 都會在使用者離開應用程式時通知您。

請注意,willLeaveApplication 回呼從來就不是廣告點擊處理常式,因此依賴這個回呼回報點擊次數,無法產生準確的指標。舉例來說,點選 AdChoices 圖示啟動外部瀏覽器會叫用回呼,但不會計入點擊次數。

重新命名類別

下表列出第 8 版中已變更或移除的特定類別名稱。摘要說明:

  • 所有與 GADUnifiedNativeAd 相關的類別都已重新命名為 GADNativeAd
  • GADRewardBasedVideoAdGADNativeExpressAdViewGADInstreamAd 已移除。
  • 所有以 DFP 前置字元開頭的類別都已替換為 GAM 前置字元。
v7.68.0 類別 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 已移除
GADInterstitial GADInterstitialAd
GADNativeExpressAdView 已移除
GADRewardBasedVideoAd 已移除
GADInstreamAd 已移除
GADInstreamAdView 已移除

已移除/取代的方法

下表列出第 8 版的具體異動。摘要說明:

  • 已移除先前淘汰的方法和屬性。
  • 所有格式的 -willLeaveApplication: 委派方法都已移除。
  • 廣告聯播網類別名稱已移至 GADResponseInfo 屬性。
  • 測試裝置 ID 已移至「GADRequestConfiguration」資源。
v7.68.0 類別 v7.68.0 API v8.0.0 API 附註
GADMobileAds +configureWithApplicationID: -startWithCompletionHandler: 應用程式 ID 現在已在 Info.plist 中設定。
+disableAutomatedInAppPurchaseReporting -disableAutomatedInAppPurchaseReporting
+disableSDKCrashReporting -disableSDKCrashReporting
GADRequest testDevices GADRequestConfiguration.testdeviceidentifiers testDeviceIdentifiers 屬性會套用至所有廣告請求,而舊的 testDevices 屬性則是針對每個請求設定。
性別 已移除
生日 已移除
+sdkVersion GADMobileAds.sharedInstance.sdkVersion
-setBirthdayWithMonth:day:year: 已移除
-setLocationWithDescription: -setLocationWithLatitude:longitude:accuracy:
-tagForChildDirectedTreatment: [GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment]
GADErrorCode kGADError* GADError* 所有錯誤代碼常數都會移除 k 前置字元。
GADBannerView hasAutoRefreshed autoloadEnabled
inAppPurchaseDelegate 已移除
mediatedAdView 已移除
adNetworkClassName responseInfo.adNetworkClassName
DFPBannerView -setValidAdSizesWithSizes: -setValidAdSizes:
DFPBannerViewOptions -adSizeDelegate 已移除
GADBannerViewDelegate -adViewDidReceiveAd: -bannerViewDidReceiveAd:
-adView:didFailToReceiveAdWithError: -bannerView:didFailToReceiveAdWithError:
-adViewWillPresentScreen: -bannerViewWillPresentScreen:
-adViewWillDismissScreen: -bannerViewWillDismissScreen:
-adViewDidDismissScreen: -bannerViewDidDismissScreen:
-adViewWillLeaveApplication: 已移除
GADNativeCustomTemplateAd templateID GADCustomNativeAd.formatID
-performClickOnAssetWithKey:customClickHandler: -performClickOnAssetWithKey:
GADNativeAdImageAdLoaderOptions preferredImageOrientation GADNativeAdMediaAdOptions.mediaAspectRatio
GADInterstitial inAppPurchaseDelegate 已移除
isReady 已移除 請改用 canPresentFromRootViewController:error:。
hasBeenUsed 已移除
-init -initWithAdUnitID:
-setAdUnitID: -initWithAdUnitID:
adNetworkClassName responseInfo.adNetworkClassName
-interstitialWillLeaveApplication: 已移除
GADUnifiedNativeAd videoController mediaContent.videoController
adNetworkClassName responseInfo.adNetworkClassName