SDK の移行

このページでは、iOS 向け Google Mobile Ads SDK の最新バージョンと以前のバージョンの移行について説明します。バージョン 12.0.0 は 2025 年 2 月にリリースされる予定です。

11 から v12 に移行する

Xcode 16.0 へのアップグレード

サポートされている Xcode の最小バージョンが 16.0 に引き上げられました。

Swift の命名サポート

バージョン 12.0.0 には、Swift のAPI 設計ガイドラインの命名規則に準拠するための変更が含まれています。この変更は Swift にのみ影響します。Objective-C API の名前は変更されていません。

クラス接頭辞の変更

クラス接頭辞には次の変更が加えられました。

  • すべての型の名前から GAD 接頭辞を削除。
  • GAM 接頭辞の名前を AdManager に変更しました。
  • GADM 接頭辞の名前を Mediation に変更しました。

エラーを解決する。

これらの変更によって生じたエラーを解決するには、Fix-it で修正することをおすすめします。

名前の競合を解決する

名前の競合を解決するには、モジュールによって提供される名前空間を使用します。たとえば、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
アド マネージャー
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 の変更

GADVideoControllerisMuted プロパティと setMute: メソッドは、muted プロパティに置き換えられました。

インライン アダプティブ広告の変更

スペースの使用を最適化するため、インライン アダプティブ広告は最初はフレーム内のスペースを占有しません。インライン アダプティブ広告サイズで CGSizeFromGADAdSize(_:) を呼び出すと、Google Mobile Ads SDK が広告を返すまで 0 の高さが返されるようになりました。

カスタム検索広告のサポート終了

次のクラスは削除され、代替はありません。

  • GADDynamicHeightSearchBannerView
  • GADDynamicHeightSearchRequest
  • GADSearchBannerView

エラーコードの変更

次のエラーコードが変更されました。

クラス メモ
GADErrorMediationNoFill エラーが GADErrorNoFill として返されるようになりました。
GADErrorReceivedInvalidResponse GADErrorReceivedInvalidAdString に置き換えられました。

GADSimulatorID を削除しました

GADSimulatorID を削除しました。シミュレータはデフォルトですでにテストモードになっています。

カスタム ターゲティングの変更

GADRequestcustomTargeting ディクショナリで、値の型として String ではなく Any が使用されるようになりました。これにより、数値を API に渡すことができます。

エクストラ パラメータの変更

  • additionalParameters にキーを渡しても、アド マネージャーの広告リクエストにカスタム ターゲティングが適用されなくなりました。カスタム ターゲティングを適用するには、カスタム ターゲティングをご覧ください。

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 にリンクし、Firebase 向け Google アナリティクス SDK をアプリに統合します。

全画面広告の表示に関する変更

以下の変更は、さまざまな広告フォーマットに影響します。

  • アプリ起動
  • インタースティシャル
  • 特典
  • リワード インタースティシャル

-canPresentFromRootViewController:error:-presentFromRootViewController: のビュー コントローラ パラメータは null を許容します。nil が渡された場合、広告はビュー コントローラ階層の最上位のビュー コントローラから表示されます。

削除されたメソッド

次のメソッドは削除されました。

v11.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 プロパティを使用してください。

削除されたプロパティ

次のプロパティは削除されます。

v11.0.0 クラス プロパティ メモ
GADMediationAdConfiguration hasUserLocation 代替はありません。
userLatitude
userLongitude
userLocationAccuracyInMeters
childDirectedTreatment 代わりに GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment を使用してください。
GADResponseInfo adNetworkClassName 代わりに loadedAdNetworkResponseInfoadNetworkClassName を使用してください。

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 がリクエストされた広告タイプのデリゲート プロトコルに準拠していない場合、GADAdLoader は広告リクエストを行いません。以前は、広告リクエストの後に失敗していました。

テストの動作の変更

次のプロパティが true を返す場合の更新された条件を示す表をご覧ください。

クラス プロパティ
GADMediationAdConfiguration isTestRequest
GADCustomEventRequest isTesting
v10.0.0 v11.0.0
  • デバイスが testDeviceIdentifiers でテストデバイスとして明示的に宣言されている。
  • デバイスが testDeviceIdentifiers でテストデバイスとして明示的に宣言されている。
  • デバイスがシミュレータである。
  • デバイスがアド マネージャーの管理画面でテストデバイスとして明示的に宣言されている。

v9 から v10 に移行する

iOS 11 での広告配信が停止されます

Google Mobile Ads SDK バージョン 10.0.0 では、iOS 12 以降を搭載したデバイスでのみ広告が配信されます。

Google Mobile Ads SDK バージョン 10.0.0 へのアップグレードによって、iOS 10 と iOS 11 デバイス上でアプリの機能が壊れることはありませんが、広告は配信されなくなります。

アド マネージャー アプリ ID の要件

すべてのアド マネージャー アプリの Info.plist で、アド マネージャー アプリ ID(ca-app-pub-################~########## 形式)が必要となります。詳しくは、Info.plist の更新についての記事をご覧ください。

GoogleAppMeasurement.xcframework の要件

Google AppMeasurement.xcframework は、すべてのアド マネージャー アプリで必須になりました。Cocoapods または Swift Package Manager を使用して Google Mobile Ads SDK をインストールする場合は、追加のご対応は必要ありません。フレームワークを手動でインストールする場合は、手動ダウンロードに関する記事で詳細をご覧ください。

ビットコードによるビルドのサポートが終了しました

Google Mobile Ads SDK を統合するには、モバイルアプリでビットコードを無効にする必要があります。

削除された型

タイプ メモ
GADGender 代替はありません。
GADMRewardBasedVideoAdNetworkAdapterProtocol ネットワークの選択に関する記事に記載されているすべてのリワード メディエーション アダプタでは、これらのプロトコルの使用が 1 年以上停止しています。 メディエーションとカスタム イベントには、 GADMediationAdapter を使用してください。
GADMRewardBasedVideoAdNetworkConnectorProtocol

削除されたプロパティ

次のプロパティは削除され、代替はありません。

v10.0.0 クラス プロパティ
GADMediationAdRequest userBirthday
userGender
userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription
GADCustomEventRequest userHasLocation
userLatitude
userLongitude
userLocationAccuracyInMeters
userLocationDescription

v8 から v9 に移行する

iOS 10 で広告配信が停止

Google Mobile Ads SDK バージョン 9.0.0 がサポートする iOS バージョンは iOS 11 以降です。

Google Mobile Ads SDK バージョン 9.0.0 へのアップグレードによって、iOS 10 デバイス上でアプリの機能が壊れることはありませんが、広告は配信されなくなります。

ステータスバー コントロールの適用強化

バージョン 9.0.0 以降、全画面フォーマットの広告を表示する場合は、ステータスバーの表示を広告で制御できるようにアプリを作る必要があります。それができていない場合は、ログにエラー メッセージが表示されます。

アプリ内のビュー コントローラのレイアウトによっては、制御に必要な変更がない場合があります。広告の rootViewControllerchildViewControllerForStatusBarHidden プロパティを設定する必要があるかどうかを検討してください。

adDidPresentFullScreenContent: の名称を adWillPresentFullScreenContent: に変更

動作の変更はありません。デリゲート メソッドは、広告が表示される直前に呼び出されます。そこで、新しいメソッド名ではその機能をわかりやすく反映しました。

GADRequest から Location Setting API を削除

Google が広告をターゲティングする際に位置情報は使われないため、- (void)setLocationWithLatitude:longitude:accuracy:GADRequest から削除されました。第三者広告ネットワークに位置情報を渡す必要がある場合は、サードパーティの API をご利用ください。

カスタム イベント インターフェースのサポート終了

カスタム イベントを使用すると、広告マネージャー メディエーションをご利用の際に、サポート対象広告ネットワーク以外の広告ネットワーク向けのウォーターフォール メディエーションを追加できます。

すべてのカスタム イベント プロトコルはサポートが終了しました。同じ機能を実現するには、代わりに既存の GADMediationAdapter プロトコルと GADMediationAdEventDelegate プロトコルを使用してください。この変更により明確性が向上し、以前は利用できなかったリワード広告とインタースクローラー広告用のカスタム イベントを作成できるようになりました。

API

下の表は、バージョン 9.0.0 以降で使うべきカスタム イベント API に対応するメディエーション アダプタ 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 を使用してください。
GAMRequest GAMRequestkGAMSimulatorID はサポートが終了しました。代わりに GADRequestConfigurationGADSimulatorID を使用してください。
GADCustomNativeAd GADCustomNativeAdmediaView はサポートが終了しました。代わりに mediaContent を使用してください。
GoogleMobileAds の In-App Purchase API GoogleMobileAdsinAppPurchase API は削除されました。

v7 から v8 に移行する

Google Mobile Ads SDK バージョン 8.0.0 では、一部の API 名の変更と削除に加えて、いくつかの大幅な変更が行われます。

全画面フォーマットの API の更新

バージョン 8.0.0 以降では、一貫性向上を目的として、インタースティシャル広告とリワード広告で汎用的な全画面表示の広告スタイルが共有されます。全画面広告の新しい API とバージョン 7 の全画面広告の API には、主に以下の 2 つの違いがあります。

  1. 静的クラスメソッド load

    全画面広告の読み込みや表示の従来の手法は、以下のとおりです。

    1. 広告オブジェクトのインスタンスを作成し、そのインスタンスへの参照を保持します。
    2. 読み込みコールバックと表示コールバックを処理するデリゲートを 1 つ割り当てます。
    3. 広告を読み込みます。
    4. isReady を使って、広告が読み込まれたかどうかを確認します。
    5. 広告を表示します。

    バージョン 8 ではこの手法が若干変わり、読み込みコールバックがデリゲートに含まれなくなりました。代わりに、読み込みコールバックが完了ハンドラとして load メソッドに渡されます。

    1. 広告クラスで静的読み込みメソッドを呼び出し、読み込み完了ハンドラを指定します。
    2. 読み込み完了コールバックで、返されて読み込んだ広告への参照を保持します。
    3. 表示コールバックを処理するデリゲートを割り当てます。
    4. 広告を表示します。

    新しい手法には以下のメリットがあります。

    • 読み込まれていない広告への参照を保持することがありません。
    • 読み込み中の広告のオブジェクトを保持する必要がありません。
  2. 一貫した広告イベント。

    イベントの種類 既存の API v8 API
    読み込みイベント GADInterstitialDelegate または GADRewardedAdDelegate GAMInterstitialAdLoadCompletionHandler または GADRewardedAdLoadCompletionHandler
    表示イベント GADFullScreenContentDelegate

    これまで、広告イベントをリッスンするには、ご利用の広告フォーマットに応じて、GADInterstitialDelegate プロトコルを実装するクラスをインタースティシャルのデリゲート プロパティに登録するか、GADRewardedAdDelegate プロトコルを実装するクラスをリワード広告のデリゲート プロパティに登録する方法をとりました。また、この同じデリゲートに、広告の読み込みと表示の両方のライフサイクル関連メソッドがありました。

    バージョン 8 では、読み込みイベントと表示イベントが別々になったため、広告を表示する前にいつでも GADFullScreenContentDelegate を登録できるようになり、広告を読み込む前に単体のデリゲートを設定する必要がなくなりました。各フォーマットに固有の広告読み込みイベントは、読み込みメソッドで渡される単体の読み込み完了ハンドラに移っています。

インタースティシャル

広告を読み込む

下記のコード スニペットは、インタースティシャル広告を読み込んで、広告の読み込みが成功または失敗したときのイベントをリッスンする方法を示しています。

v7

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController, GADInterstitialDelegate {

  var interstitial: DFPInterstitial!

  override func viewDidLoad() {
    super.viewDidLoad()
    interstitial = DFPInterstitial(adUnitID: "/21775744923/example/interstitial")
    interstitial.delegate = self
    let request = GAMRequest()
    interstitial.load(request)
  }

  /// Tells the delegate an ad request succeeded.
  func interstitialDidReceiveAd(_ ad: DFPInterstitial) {
    print("Interstitial ad loaded.")
  }

  /// Tells the delegate an ad request failed.
  func interstitial(_ ad: DFPInterstitial, didFailToReceiveAdWithError error: GADRequestError) {
    print("Interstitial ad failed to load with error: \(error.localizedDescription)")
  }
}

Objective-C

@import GoogleMobileAds;
@import UIKit;

@interface ViewController () 

@property(nonatomic, strong) DFPInterstitial *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  self.interstitial = [[DFPInterstitial alloc]
      initWithAdUnitID:@"/21775744923/example/interstitial"];
  self.interstitial.delegate = self;
  GAMRequest *request = [GAMRequest request];
  [self.interstitial loadRequest:request];
}

/// Tells the delegate an ad request succeeded.
- (void)interstitialDidReceiveAd:(DFPInterstitial *)ad {
  NSLog(@"Insterstitial ad loaded.");
}

/// Tells the delegate an ad request failed.
- (void)interstitial:(DFPInterstitial *)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: GAMInterstitialAd?

  override func viewDidLoad() {
    super.viewDidLoad()
    let request = GAMRequest()
    GAMInterstitialAd.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) GAMInterstitialAd *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  GAMRequest *request = [GAMRequest request];
  [GAMInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial"
                              request:request
                    completionHandler:^(GAMInterstitialAd *ad, NSError *error) {
    if (error) {
      NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
      return;
    }
    self.interstitial = ad;
    self.interstitial.fullScreenContentDelegate = self;
  }];
}

ディスプレイ広告

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

広告表示イベント

下記のコード スニペットは、広告表示が成功または失敗した場合と拒否された場合のコールバックの処理方法を示しています。

v7

Swift

override func viewDidLoad() {
  super.viewDidLoad()
  interstitial = DFPInterstitial(adUnitID: "/21775744923/example/interstitial")
  interstitial.delegate = self
  ...
}

/// Tells the delegate that an interstitial will be presented.
func interstitialWillPresentScreen(_ ad: DFPInterstitial) {
  print("Interstitial ad will be presented.")
}

/// Tells the delegate the interstitial is to be animated off the screen.
func interstitialWillDismissScreen(_ ad: DFPInterstitial) {
  print("Interstitial ad will be dismissed.")
}

/// Tells the delegate the interstitial had been animated off the screen.
func interstitialDidDismissScreen(_ ad: DFPInterstitial) {
  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: DFPInterstitial) {
  print("Interstitial ad will leave application.")
}

Objective-C

- (void)viewDidLoad {
  [super viewDidLoad];
  self.interstitial = [[DFPInterstitial alloc] initWithAdUnitID:"/21775744923/example/interstitial"];
  self.interstitial.delegate = self;
  ...
}

/// Tells the delegate that an interstitial will be presented.
- (void)interstitialWillPresentScreen:(DFPInterstitial *)ad {
  NSLog(@"Interstitial ad will be presented.");
}

/// Tells the delegate the interstitial is to be animated off the screen.
- (void)interstitialWillDismissScreen:(DFPInterstitial *)ad {
  NSLog(@"Interstitial ad will be dismissed.");
}

/// Tells the delegate the interstitial had been animated off the screen.
- (void)interstitialDidDismissScreen:(DFPInterstitial *)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:(DFPInterstitial *)ad {
  NSLog(@"Interstitial ad will leave application.");
}

v8

Swift

override func viewDidLoad() {
  super.viewDidLoad()
  let request = GAMRequest()
  GAMInterstitialAd.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];
  GAMRequest *request = [GAMRequest request];
  [GAMInterstitialAd loadWithAdUnitID:@"/21775744923/example/interstitial"
                              request:request
                    completionHandler:^(GAMInterstitialAd *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.");
}

特典

広告を読み込む

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(GAMRequest()) { 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;
  GAMRequest *request = [GAMRequest 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 = GAMRequest()
  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];

  GAMRequest *request = [GAMRequest 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 では、GADRewardedAdDelegate プロトコルの一環として rewardedAd:userDidEarnReward: を実装します。バージョン 8 の場合は、広告を表示するために GADUserDidEarnRewardHandler を実装します。

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

広告表示イベント

GADRewardedAd API で、広告を表示するメソッドに GADRewardedAdDelegate を渡します。広告を表示する前に、GADRewardedAd API でプロパティとして GADFullscreenContentDelegate を広告に設定します。

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 = GAMRequest()
  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];

  GAMRequest *request = [GAMRequest 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 月に初めて導入され、その後 18 か月間にわたってリワード広告用 API として推奨されています。一度に複数のリワード広告を読み込むことができるなど、従来の GADRewardedBasedVideoAd API にさらなる改善が行われています。

従来の GADRewardedBasedVideoAd API は、SDK バージョン 8.0.0 で削除されます。

アダプティブ バナーの導入に合わせてスマートバナーのサポートを終了

アダプティブ バナー広告の導入に合わせて、スマートバナー広告のサポートを終了しました。アダプティブ バナーでは、パフォーマンスと広告の幅を設定する際の柔軟性が向上しています。全幅表示のバナーを引き続き使用したい場合は、以下のコード スニペットに示されるようにアダプティブ バナーを使用してください。

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 コールバックが削除されました。OS レベルの 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