<br />

This page covers migrations for current and previous versions of
Google Mobile Ads SDK for iOS. We expect to release version 13.0.0 in February
2026.

## Migrate from v12 to v13

### Increased minimum deployment target

The minimum deployment target has increased to iOS 13.

### Changes to anchored adaptive banner size APIs

Version 13.0.0 deprecates the existing anchored adaptive banner size APIs and
introduces size APIs for large anchored adaptive banner ads. Google Mobile Ads SDK can
serve video demand to banner ads using the new large anchored adaptive banner
size APIs.

The following table details the deprecated sizing APIs and their replacements:

| v12 (Deprecated) | v13 (Replacement) |
|---|---|
| `GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)` | [`GADLargeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt#gadlargeanchoredadaptivebanneradsizewithwidth) |
| `GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)` | [`GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt#gadlargeportraitanchoredadaptivebanneradsizewithwidth) |
| `GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)` | [`GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt#gadlargeportraitanchoredadaptivebanneradsizewithwidth) |

### Continued Swift 6 concurrency support

Version 13.0.0 continues adding support for Swift 6 strict concurrency.

### Added stricter type enforcement for `neighboringContentURLStrings` array

Starting with version 13.0.0, Google Mobile Ads SDK raises an exception if an
object that is not a `String` type is detected in the
[`neighboringContentURLStrings`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequest.md.txt#neighboringcontenturlstrings)
array.

## Migrate from v11 to v12

### Upgrade to Xcode 16.0

The minimum supported Xcode version has increased to 16.0.

### Swift naming support

Version 12.0.0 includes changes to follow the naming conventions in the Swift
[API Design Guidelines](https://swift.org/documentation/api-design-guidelines/).
These changes impact Swift only. No naming changes have been made to the
Objective-C APIs.

#### Class prefix changes

The following changes have been made to the class prefixes:

- Removed the `GAD` prefix across names for all types.
- Renamed the `GAM` prefix to `AdManager`.
- Renamed the `GADM` prefix to `Mediation`.

#### Resolve errors

The best way to resolve errors resulting from these changes is to
[make a Fix-It correction](https://developer.apple.com/documentation/xcode/fixing-issues-in-your-code-as-you-type#Make-a-Fix-It-correction).

#### Resolve naming conflicts

To resolve naming conflicts, use the namespace provided by the module. For
example, `GADRequest` is now named `Request`. The following example namespaces
Google Mobile Ads SDK `Request` class:

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

#### Detailed list of Swift changes

The following tables list the changes made to the Swift APIs:

| Version 11 | Version 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` |
| Mediation ||
| `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` |
| Real-time bidding ||
| `GADRTBAdapter` | `RTBAdapter` |
| `GADRTBMediationSignalsConfiguration` | `RTBMediationSignalsConfiguration` |
| `GADRTBRequestParameters` | `RTBRequestParameters` |

#### Constants

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

#### Properties

| Type | Version 11 | Version 12 |
|---|---|---|
| GADAdLoader | `loading` | `isLoading` |
| GADAudioVideoManager | `audioSessionApplicationManaged` | `isAudioSessionApplicationManaged` |
| GADBannerView | `autoloadEnabled` | `isAutoloadEnabled` |
| GADMobileAds | `sharedInstance` | `shared` |
| GADMobileAds | `applicationMuted` | `isApplicationMuted` |
| GADMuteThisAdReason | `reasonDescription` | `reason` |
| GADNativeAd | `customMuteThisAdAvailable` | `isCustomMuteThisAdAvailable` |
| GADNativeAdCustomClickGestureOptions | `tapsAllowed` | `areTapsAllowed` |
| GADNativeAdImageAdLoaderOptions | `imageLoadingDisabled` | `isImageLoadingDisabled` |
| GADNativeMuteThisAdLoaderOptions | `customMuteThisAdRequested` | `isCustomMuteThisAdRequested` |
| GADNativeSignalRequest | `imageLoadingDisabled` | `isImageLoadingDisabled` |
| GADNativeSignalRequest | `customMuteThisAdRequested` | `isCustomMuteThisAdRequested` |
| GADRequest | `neighboringContentURLStrings` | `neighboringContentURLs` |
| GADResponseInfo | `extrasDictionary` | `extras` |
| GADServerSideVerificationOptions | `customRewardString` | `customRewardText` |
| GADSignal | `signalString` | `signal` |
| GADSignalRequest | `neighboringContentURLStrings` | `neighboringContentURLs` |
| GADVideoController | `customControlsRequested` | `areCustomControlsRequested` |
| GADVideoController | `clickToExpandEnabled` | `isClickToExpandEnabled` |
| GADVideoOptions | `startMuted` | `shouldStartMuted` |
| GADVideoOptions | `customControlsRequested` | `areCustomControlsRequested` |
| GADVideoOptions | `clickToExpandRequested` | `isClickToExpandRequested` |

#### Functions

| Type | Version 11 | Version 12 |
|---|---|---|
| GADAdSize | `GADPortraitInlineAdaptiveBannerAdSizeWithWidth(_:)` | `portraitInlineAdaptiveBanner(width:)` |
| GADAdSize | `GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(_:)` | `landscapeInlineAdaptiveBanner(width:)` |
| GADAdSize | `GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(_:)` | `currentOrientationInlineAdaptiveBanner(width:)` |
| GADAdSize | `GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(_:, _:)` | `inlineAdaptiveBanner(width:maxHeight:)` |
| GADAdSize | `GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(_:)` | `portraitAnchoredAdaptiveBanner(width:)` |
| GADAdSize | `GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(_:)` | `landscapeAnchoredAdaptiveBanner(width:)` |
| GADAdSize | `GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(_:)` | `currentOrientationAnchoredAdaptiveBanner(width:)` |
| GADAdSize | `GADAdSizeFromCGSize(_:)` | `adSizeFor(cgSize:)` |
| GADAdSize | `GADAdSizeFullWidthPortraitWithHeight(_:)` | `fullWidthPortrait(height:)` |
| GADAdSize | `GADAdSizeFullWidthLandscapeWithHeight(_:)` | `fullWidthLandscape(height:)` |
| GADAdSize | `GADAdSizeEqualToSize(_:, _:)` | `isAdSizeEqualToSize(size1:size2:)` |
| GADAdSize | `IsGADAdSizeValid(_:)` | `isAdSizeValid(size:)` |
| GADAdSize | `GADAdSizeIsFluid(_:)` | `isAdSizeFluid(size:)` |
| GADAdSize | `CGSizeFromGADAdSize(_:)` | `cgSize(for:)` |
| GADAdSize | `NSStringFromGADAdSize(_:)` | `string(for:)` |
| GADAdSize | `NSValueFromGADAdSize(_:)` | `nsValue(for:)` |
| GADAdSize | `GADAdSizeFromNSValue(_:)` | `adSizeFor(nsValue:)` |
| GADAdSize | `GADClosestValidSizeForAdSizes(_:_:)` | `closestValidSizeForAdSizes(original:possibleAdSizes:)` |
| GADAppEventDelegate | `adView(_:didReceiveAppEvent:withInfo:)` | `adView(_:didReceiveAppEvent:with:)` |
| GADAppEventDelegate | `interstitialAd(_:didReceiveAppEvent:withInfo:)` | `adView(_:didReceiveAppEvent:with:)` |
| GADAppOpenAd | `load(withAdResponseString:)` | `load(with:)` |
| GADAppOpenAd | `load(withAdUnitID:request:completionHandler:)` | `load(with:request:completionHandler:)` |
| GADAppOpenAd | `canPresent(fromRootViewController:)` | `canPresent(from:)` |
| GADAppOpenAd | `present(fromRootViewController:)` | `present(from:)` |
| GADBannerView | `load(withAdResponseString:)` | `load(with:)` |
| GADInterstitial | `load(withAdResponseString:)` | `load(with:)` |
| GADInterstitial | `load(withAdUnitID:request:completionHandler:)` | `load(with:request:completionHandler:)` |
| GADInterstitial | `canPresent(fromRootViewController:)` | `canPresent(from:)` |
| GADInterstitial | `present(fromRootViewController:)` | `present(from:)` |
| GADRewardedAd | `load(withAdResponseString:)` | `load(with:)` |
| GADRewardedAd | `load(withAdUnitID:request:completionHandler:)` | `load(with:request:completionHandler:)` |
| GADRewardedAd | `canPresent(fromRootViewController:)` | `canPresent(from:)` |
| GADRewardedAd | `present(fromRootViewController:userDidEarnRewardHandler:)` | `present(from:userDidEarnRewardHandler:)` |
| GADRewardedInterstitialAd | `load(withAdResponseString:)` | `load(with:)` |
| GADRewardedInterstitialAd | `load(withAdUnitID:request:completionHandler:)` | `load(with:request:completionHandler:)` |
| GADRewardedInterstitialAd | `canPresent(fromRootViewController:)` | `canPresent(from:)` |
| GADRewardedInterstitialAd | `present(fromRootViewController:userDidEarnRewardHandler:)` | `present(from:userDidEarnRewardHandler:)` |
| GADVersionNumber | `GADGetStringFromVersionNumber(_ version: GADVersionNumber)` | `string(for:)` |
| Mediation |||
| GADMAdNetworkAdapter | `getBannerWith(_:)` | `getBanner(with:)` |
| GADMAdNetworkAdapter | `presentInterstitial(fromRootViewController:)` | `presentInterstitial(from:)` |
| GADMAdNetworkAdapter | `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:)` |

### Set custom targeting parameters

To set custom targeting on an ad request, use
[`customTargeting`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequest.md.txt#customtargeting).

### API changes to controlling video mute state

The `isMuted` property and `setMute:` method on `GADVideoController` are
replaced with a `muted` property.

### Changes to inline adaptive ads

To optimize space utilization, inline adaptive ads initially occupy no space
in the frame. Calling [`CGSizeFromGADAdSize(_:)`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions.md.txt#cgsizefromgadadsize) with
an inline adaptive ad size now returns `0` height until the Google Mobile Ads
SDK returns an ad.

### Removed custom search ads

The following classes are removed with no replacement:

- `GADDynamicHeightSearchBannerView`
- `GADDynamicHeightSearchRequest`
- `GADSearchBannerView`

### Changes to error codes

The following error codes have been changed:

| Class | Notes |
|---|---|
| `GADErrorMediationNoFill` | Errors now return as `GADErrorNoFill`. |
| `GADErrorReceivedInvalidResponse` | Has been replaced with `GADErrorReceivedInvalidAdString`. |

### Removed GADSimulatorID

Removed `GADSimulatorID`. Simulators are already in test mode by default.

### Changes to custom targeting

The `customTargeting` dictionary on `GADRequest` now uses `Any` instead of
`String` as the value type. This lets you pass numerical values to the API.

### Changes to extras parameters

- Passing keys into [`additionalParameters`](https://developers.google.com/admob/ios/api/reference/Classes/GADExtras.md.txt#/c:objc(cs)GADExtras(py)additionalParameters) no longer applies custom targeting to Ad Manager ad requests. To apply custom targeting, see [custom targeting](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/targeting.md.txt#custom_targeting).

<!-- -->

- Passing the `max_ad_content_rating` key into [`additionalParameters`](https://developers.google.com/admob/ios/api/reference/Classes/GADExtras.md.txt#/c:objc(cs)GADExtras(py)additionalParameters) is no longer supported. To set a maximum ad content rating, see [ad content filtering](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/targeting.md.txt#ad_content_filtering).

## Migrate from v10 to v11

### Minimum deployment target

The minimum deployment target has been increased to iOS 12.

### Minimum Xcode version

The minimum supported Xcode version has been increased to 15.1.

### Ads stop serving on iOS 12

Google Mobile Ads SDK version 11.0.0 serves ads only on devices running iOS 13
and higher.

> [!NOTE]
> **Note:** Google Mobile Ads SDK version 11.0.0 still builds on iOS 12 devices, but no ads will serve.

### Removed GoogleAppMeasurement dependency

In version 11.0.0, the dependency on
[`GoogleAppMeasurement`](https://github.com/google/GoogleAppMeasurement) has been
removed. This dependency that powered the user metrics toggle in AdMob will be
[discontinued](https://support.google.com/admob/answer/15273207) in early 2024. To
continue collecting user metrics in AdMob,
[link your AdMob app to Firebase](https://support.google.com/admob/answer/6383165) and
integrate the
[Google Analytics for Firebase](https://firebase.google.com/docs/analytics) SDK into
your app.

### Changes to full-screen ad presentation

The following changes affect the various ad formats:

- App open
- Interstitial
- Rewarded
- Rewarded interstitial

The view controller parameter in `-canPresentFromRootViewController:error:` and
`-presentFromRootViewController:` is nullable. If nil is passed, the ad is
presented from the topmost view controller in the view controller hierarchy.

### Methods removed

The following methods are removed.

| v11.0.0 Type | Method | Notes |
|---|---|---|
| GADAppOpenAd | `load(withAdUnitID adUnitID: String, request: GADRequest?, orientation: UIInterfaceOrientation)` | Use [`load(withAdUnitID adUnitID: String, request: GADRequest?)`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADAppOpenAd.md.txt#declaration) instead. |
| GADMediationBannerAdEventDelegate | `willBackgroundApplication()` | No replacement. |
| GADMediationInterstitialAdEventDelegate | `willBackgroundApplication()` | No replacement. |
| GADMediationNativeAdEventDelegate | `willBackgroundApplication()` | No replacement. |
| GADMediationRewardedAdEventDelegate | `didRewardUser(with reward: GADAdReward)` | Use [`didRewardUser()`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADMediationRewardedAdEventDelegate.md.txt#-didrewarduser) instead. |
| GADMediatedUnifiedNativeAdNotificationSource | `mediatedNativeAdWillLeaveApplication(_ mediatedNativeAd: GADMediatedUnifiedNativeAd)` | No replacement. |
| GADRequestConfiguration | `setSameAppKeyEnabled(_ enabled: Bool)` | Use `setPublisherFirstPartyIDEnabled(_ enabled: Bool)` instead. |
| GADRequestConfiguration | `tagForUnderAge(ofConsent underAgeOfConsent: Bool)` | Use the [`tagForUnderAgeOfConsent`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequestConfiguration.md.txt#tagforunderageofconsent) property instead. |
| GADRequestConfiguration | `tag(forChildDirectedTreatment childDirectedTreatment: Bool)` | Use the [`tagForChildDirectedTreatment`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequestConfiguration.md.txt#tagforchilddirectedtreatment) property instead. |

### Properties removed

The following properties are removed.

| v11.0.0 Class | Property | Notes |
|---|---|---|---|---|
| GADMediationAdConfiguration | hasUserLocation | No replacement. |
| GADMediationAdConfiguration | userLatitude | No replacement. |   |   |
| GADMediationAdConfiguration | userLongitude | No replacement. |   |   |
| GADMediationAdConfiguration | userLocationAccuracyInMeters | No replacement. |   |   |
| GADMediationAdConfiguration | childDirectedTreatment | Use [`GADMobileAds.sharedInstance.requestConfiguration.tagForChildDirectedTreatment`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequestConfiguration.md.txt#tagforchilddirectedtreatment) instead. |   |
| GADResponseInfo | adNetworkClassName | Use `adNetworkClassName` from [`loadedAdNetworkResponseInfo`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADResponseInfo.md.txt#loadedadnetworkresponseinfo) instead. |

### Removed GADAdFormatUnknown

Removed `GADAdFormatUnknown` with no replacement.

### Changes to logging SDK version

Version 11.0.0 removes `sdkVersion`. To log Google Mobile Ads SDK version,
use [`versionNumber`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADMobileAds.md.txt#versionnumber)
instead.

### Version 10.0.0

```swift
GADMobileAds.sharedInstance().sdkVersion
```

### Version 11.0.0

```swift
GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)
```

### Changes to GADAdLoader error handling

Starting in version 11.0.0, `GADAdLoader` doesn't make an ad request if its
[`delegate`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADAdLoader.md.txt#delegate)
doesn't conform to the requested ad types' delegate protocol. Previously, it
failed after the ad request was made.

### Changes to testing behavior

See the table which shows the updated conditions for when the following
properties return `true`.

| Class | Property |
|---|---|
| GADMediationAdConfiguration | [`isTestRequest`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADMediationAdConfiguration.md.txt#istestrequest) |
| GADCustomEventRequest | [`isTesting`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADCustomEventRequest.md.txt#istesting) |
| - The device is explicitly declared as a test device in `testDeviceIdentifiers`. | - The device is explicitly declared as a test device in `testDeviceIdentifiers`. - The device is a simulator. - The device is explicitly declared as a test device in the Ad Manager UI. |

## Migrate from v9 to v10

### Ads stop serving on iOS 11

Google Mobile Ads SDK version 10.0.0 serves ads only on devices running iOS 12
and higher.

Upgrading to Google Mobile Ads SDK version 10.0.0 will not break your app on iOS
11 and iOS 10 devices, however, no ads will be served on those devices.

### Requirement of Ad Manager App ID

The Ad Manager App ID is now required in `Info.plist` for all Ad Manager apps and
requires the `ca-app-pub-################~##########` format. See [Update your Info.plist](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#update_your_infoplist)
for more details.

### Requirement of GoogleAppMeasurement.xcframework

GoogleAppMeasurement.xcframework is now required for all Ad
Manager apps. If you install Google Mobile Ads SDK through [Cocoapods](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#cocoapods)
or [Swift Package Manager](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#spm), no
additional action is required. If you install frameworks manually, see
[Manual Download](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#manual_download) for
more details.

### Building with bitcode is no longer supported

Disabling bitcode in your mobile apps is now required to integrate the
Google Mobile Ads SDK.

### Types removed

| Type | Notes |
|---|---|
| GADGender | No replacement. |
| GADMRewardBasedVideoAdNetworkAdapterProtocol | All rewarded mediation adapters listed on [Choose Networks](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/choose-networks.md.txt#network_details) have stopped using these protocols for over a year. Use [GADMediationAdapter](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADMediationAdapterGADMediationAdapter) for mediation and custom events. |
| GADMRewardBasedVideoAdNetworkConnectorProtocol | All rewarded mediation adapters listed on [Choose Networks](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/choose-networks.md.txt#network_details) have stopped using these protocols for over a year. Use [GADMediationAdapter](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADMediationAdapterGADMediationAdapter) for mediation and custom events. |

### Properties removed

The following properties are removed with no replacement.

| v10.0.0 Class | Property |
|---|---|---|
| GADMediationAdRequest | userBirthday |
| GADMediationAdRequest | userGender |   |
| GADMediationAdRequest | userHasLocation |   |
| GADMediationAdRequest | userLatitude |   |
| GADMediationAdRequest | userLongitude |   |
| GADMediationAdRequest | userLocationAccuracyInMeters |   |
| GADMediationAdRequest | userLocationDescription |   |
| GADCustomEventRequest | userHasLocation |
| GADCustomEventRequest | userLatitude |   |
| GADCustomEventRequest | userLongitude |   |
| GADCustomEventRequest | userLocationAccuracyInMeters |   |
| GADCustomEventRequest | userLocationDescription |   |

## Migrate from v8 to v9

### Ads stop serving on iOS 10

The minimum iOS version Google Mobile Ads SDK version 9.0.0 supports is iOS
11.

Upgrading to Google Mobile Ads SDK version 9.0.0 will not break your app on iOS
10 devices, however, no ads will be served on those devices.

### Stricter enforcement of status bar controls

Starting from version 9.0.0, when you present full-screen format ads, your app
should ensure that the ads are able to control the presentation of the status
bar. You will see an error message in the logs if you fail to do so.

Depending on the specific layout of view controllers in your app, you might not
need to make any changes to ensure this. Consider whether you need to set the
[`childViewControllerForStatusBarHidden`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621451-childviewcontrollerforstatusbarh?language=objc)
property on your ad's `rootViewController`.

### Rename adDidPresentFullScreenContent: to adWillPresentFullScreenContent:

There is no behavior change. The delegate method is invoked right before the ad
is about to be presented, so the new method name better reflects its
functionality.

### Remove location setting API on GADRequest

`- (void)setLocationWithLatitude:longitude:accuracy:` has been deleted from
`GADRequest` since location data is not used by Google to target ads. Use
third-party APIs to provide the information to third-party ad networks if
required.

### Custom event interfaces deprecation

[Custom events](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/custom-events/overview) enable publishers using
Ad Manager Mediation to add waterfall mediation for an ad network that
isn't one of the [supported ad networks](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/choose-networks.md.txt).

All the custom event protocols are deprecated. Instead, use the existing
[`GADMediationAdapter`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADMediationAdapter.md.txt)
and
[`GADMediationAdEventDelegate`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADMediationAdEventDelegate.md.txt)
protocols to achieve the same functionalities. This change improves clarity and
enables you to create custom events for rewarded ads and interscroller ads which
were not previously available.

#### APIs

The table below lists the corresponding mediation adapter APIs to custom events
APIs that should be used starting from version 9.0.0.

| v8 | v9 ||
| GADCustomEventBanner GADCustomEventInterstitial GADCustomEventNativeAd | GADMediationAdapter | GADMediationBannerAd GADMediationInterstitialAd GADMediationInterscrollerAd GADMediationRewardedAd GADMediationNativeAd |
|---|---|---|
| `delegate` | Delegate is returned by the load completion handler of each load function of `GADMediationAdapter` class |   |
| `-init` | `-init` |   |
| `-requestBannerAd:parameter:label:request:` | `-loadBannerForAdConfiguration:completionHandler:` |   |
| `-requestInterstitialAdWithParameter:label:request:` | `-loadInterstitialForAdConfiguration:completionHandler:` |   |
| `-requestNativeAdWithParameter:request:adTypes:options:rootViewController:` | `-loadNativeAdForAdConfiguration:completionHandler:` |   |
| N/A | `-loadInterscrollerAdForAdConfiguration:completionHandler:` |   |
| N/A | `-loadRewardedAdForAdConfiguration:completionHandler:` |   |
| `-presentFromRootViewController:` |   | `-presentFromViewController:` |
| `-handlesUserClicks` |   | `-handlesUserClicks` |
| `-handlesUserImpressions` |   | `-handlesUserImpressions` |

#### Delegate methods

The table below lists the corresponding mediation ad event delegate methods to
custom event delegate methods that should be used starting from version 9.0.0.

| v8 | v9 ||
| GADCustomEventBannerDelegate GADCustomEventInterstitialDelegate GADCustomEventNativeAdDelegate | GADMediationAdEventDelegate | GADMediationAd |
|---|---|---|
| `-customEventBanner:didReceiveAd:` `-customEventInterstitialDidReceiveAd:` | Ad load status is included in the load completion handler of each load function in the `GADMediationAdapter` class |   |
| `-customEventBanner:didFailAd:` `-customEventInterstitial:didFailAd:` | Ad load status is included in the load completion handler of each load function in the `GADMediationAdapter` class |   |
| `-customEventBannerWasClicked:` `-customEventInterstitialWasClicked:` | `-reportClick` |   |
| `-customEventBannerWillPresentModal:` `-customEventInterstitialWillPresentModal:` | `-willPresentFullScreenView` |   |
| `-customEventBannerWillDismissModal:` `-customEventInterstitialWillDismissModal:` | `-willDismissFullScreenView` |   |
| `-customEventBannerDidDismissModal:` `-customEventInterstitialDidDismissModal:` | `-didDismissFullScreenView` |   |
| `-customEventBannerWillLeaveApplication:` `-customEventInterstitialWillLeaveApplication:` | `-willBackgroundApplication` |   |
| `viewControllerForPresentingModalView` |   | `-[GADMediationBannerAd view]` |

### Other removed/replaced methods and constants

| Changes to method, constant, or property ||
|---|---|
| `kGAD-` prefixed constants | Removed. Use `GAD-` prefixed constants. |
| `GADAdNetworkResponseInfo` | `credentials` were removed. Use `adUnitMapping` instead. |
| `GAMRequest` | `kGAMSimulatorID` in `GAMRequest` is deprecated. Use `GADSimulatorID` in `GADRequestConfiguration` instead. |
| `GADCustomNativeAd` | `mediaView` in `GADCustomNativeAd` is deprecated. Use `mediaContent` instead. |
| In-App Purchase APIs in `GoogleMobileAds` | `inAppPurchase` APIs in `GoogleMobileAds` were removed. |

## Migrate from v7 to v8

Google Mobile Ads SDK version 8.0.0 introduces a few major changes as well as
some renames and removals of APIs.

### Full-screen format API updates

Starting with version 8.0.0, interstitial and rewarded ads share a generic full
screen ad style for more consistency. These new full-screen ad APIs have two
major distinctions from the version 7 full-screen ad APIs:

1. **Static class method `load`.**

   The previous approach to load/show a full-screen ad is as follows:
   1. Create an ad object instance and hold a reference to it.
   2. Assign a delegate that handles load and show callbacks.
   3. Load an ad.
   4. Check if ad is loaded using `isReady`.
   5. Show the ad.

   In version 8, the approach changes slightly. Load callbacks are no longer
   part of a delegate. Instead, they're passed into the `load` method as a
   completion handler:
   1. Call a static load method on the ad class and provide a load completion handler.
   2. In the load completion callback, keep a reference to the loaded ad that's returned.
   3. Assign a delegate that handles show callbacks.
   4. Show the ad.

   The new approach provides these benefits:
   - You won't ever have a reference to an ad that is not loaded.
   - You don't have to hold onto an ad object while it's loading.
2. **Consistent ad events.**

   | Event type | Existing API | v8 API |
   |---|---|---|
   | **Load events** | `GADInterstitialDelegate` or `GADRewardedAdDelegate` | `GAMInterstitialAdLoadCompletionHandler` or `GADRewardedAdLoadCompletionHandler` |
   | **Presentation events** | `GADInterstitialDelegate` or `GADRewardedAdDelegate` | `GADFullScreenContentDelegate` |

   Previously, to listen for any ad events, you would register a class that
   implements the
   [`GADInterstitialDelegate`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADInterstitialDelegate)
   protocol to an interstitial's delegate property, or register a class that
   implements the
   [`GADRewardedAdDelegate`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADRewardedAdDelegate)
   protocol to a rewarded ad's delegate property depending on which format
   you're using. This same delegate had methods related to both the loading and
   presentation life cycle of an ad.

   With version 8, load and presentation events are separate. You can now
   register a
   [`GADFullScreenContentDelegate`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Protocols/GADFullScreenContentDelegate.md.txt)
   any time prior to showing an ad instead of being required to set a single
   delegate prior to loading the ad. Ad load events, which are specific to each
   format, move to a single load completion handler passed in the load method.

#### Interstitial

##### Load ad

The code snippets below show you how to load an interstitial ad and listen for
events when the ad succeeds or fails to load.

### 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

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

<br />

### v8

<br />

<br />

### Swift

<br />

```
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
                      }
    )
  }
}
```

<br />

### Objective-C

<br />

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

<br />

<br />

<br />

<br />

##### Display ad

### v7

### Swift

```
func showInterstitial() {
  ...
  if interstitial.isReady {
    interstitial.present(fromRootViewController: self)
  } else {
    print("Ad wasn't ready")
  }
}
```

### Objective-C

```objective-c
- (void)showInterstitial: {
  ...
  if (self.interstitial.isReady) {
    [self.interstitial presentFromRootViewController:self];
  } else {
    NSLog(@"Ad wasn't ready");
  }
}
```

<br />

### v8

<br />

<br />

### Swift

<br />

```
func showInterstitial() {
  ...
  if let ad = interstitial {
    ad.present(fromRootViewController: self)
  } else {
    print("Ad wasn't ready")
  }
}
```

<br />

### Objective-C

<br />

```objective-c
- (void)showInterstitial: {
  ...
  if (self.interstitial) {
    [self.interstitial presentFromRootViewController:self];
  } else {
    NSLog(@"Ad wasn't ready");
  }
}
```

<br />

<br />

<br />

<br />

##### Presentation ad events

The code snippets below show you how to handle callbacks for when the ad
presents (successfully or unsuccessfully) and when it is dismissed.

### 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

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

<br />

### v8

<br />

<br />

### Swift

<br />

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

<br />

### Objective-C

<br />

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

<br />

<br />

<br />

<br />

#### Rewarded

##### Load ad

### 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

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

<br />

### v8

<br />

<br />

### Swift

<br />

```
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
                          }
  )
  }
}
```

<br />

### Objective-C

<br />

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

<br />

<br />

<br />

<br />

##### Display ad and handle reward

Rewarded ads require you to handle the event when a user earns a reward. With
version 7 of the `GADRewardedAd` API, you implement
`rewardedAd:userDidEarnReward:` as part of the `GADRewardedAdDelegate` protocol.
For version 8, you implement the `GADUserDidEarnRewardHandler` in order to
present the ad.

### 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

```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.
}
```

<br />

### v8

<br />

<br />

### Swift

<br />

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

<br />

### Objective-C

<br />

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

<br />

<br />

<br />

<br />

##### Presentation ad events

With the `GADRewardedAd` API you pass a `GADRewardedAdDelegate` to the method
that presents the ad. With the `GADRewardedAd` API, you set a
`GADFullscreenContentDelegate` as a property on the ad prior to presenting the
ad.

### 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

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

<br />

### v8

<br />

<br />

### Swift

<br />

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

<br />

### Objective-C

<br />

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

<br />

<br />

<br />

<br />

### Legacy GADRewardedBasedVideoAd API removal

The newer
[`GADRewardedAd`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRewardedAd.md.txt)
API was first introduced back in March 2019 and has been the preferred rewarded
API for over 18 months. It has had more enhancements compared to the legacy
`GADRewardedBasedVideoAd` API, including the ability to load more than one
rewarded ad at a time.

The legacy `GADRewardedBasedVideoAd` API is removed in SDK version 8.0.0.

### Smart banner deprecation in favor of adaptive banner

[Smart banner](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner/smart.md.txt) ads are deprecated
in favor of [adaptive banner](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner/adaptive)
ads. Adaptive banners provide superior performance and more flexibility in
setting ad width. If you prefer to continue using full-width banners, that can
still be done using adaptive banner, as shown in the following code snippet:

### Swift

```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

```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
```

### Leave application callback removal

The `willLeaveApplication` callback for all ad formats has been
removed in favor of the
[`applicationDidEnterBackground:`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622997-applicationdidenterbackground)
and
[`sceneDidEnterBackground:`](https://developer.apple.com/documentation/uikit/uiscenedelegate/3197917-scenedidenterbackground)
methods. Using OS-level APIs notify you whenever users leave your app, regardless of
whether or not it is due to an ad interaction.

Note that the `willLeaveApplication` callback was never intended to be
an ad click handler, and relying on this callback to report clicks did not
produce an accurate metric. For example, a click on the AdChoices
icon that launched an external browser invoked the callback but did not count a
click.

### Class renames

The table below lists specific class names that have changed or been removed in
version 8. In summary:

- All classes related to `GADUnifiedNativeAd` have been renamed to `GADNativeAd`.
- `GADRewardBasedVideoAd`, `GADNativeExpressAdView`, and `GADInstreamAd` have been removed.
- All classes with the `DFP` prefix have been replaced with a `GAM` prefix.

| v7.68.0 Class | v8.0.0 Class |
|---|---|
| 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 | Removed |
| GADInterstitial | GADInterstitialAd |
| GADNativeExpressAdView | Removed |
| GADRewardBasedVideoAd | Removed |
| GADInstreamAd | Removed |
| GADInstreamAdView | Removed |

### Methods removed/replaced

The table below lists the specific changes in version 8. In summary:

- Previously deprecated methods and properties have been removed.
- `-willLeaveApplication:` delegate methods have been removed for all formats.
- The ad network class name has moved to the `GADResponseInfo` property.
- The test device identifier has moved to the `GADRequestConfiguration` property.

| v7.68.0 Class | v7.68.0 API | v8.0.0 API | Notes |
|---|---|---|---|
| GADMobileAds | +configureWithApplicationID: | -startWithCompletionHandler: | The app ID is now set in Info.plist. |
| GADMobileAds | +disableAutomatedInAppPurchaseReporting | -disableAutomatedInAppPurchaseReporting |   |
| GADMobileAds | +disableSDKCrashReporting | -disableSDKCrashReporting |   |
| GADRequest | testDevices | [GADRequestConfiguration.testdeviceidentifiers](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequestConfiguration.md.txt#testdeviceidentifiers) | The testDeviceIdentifiers property applies to all ad requests, while the old testDevices property was set per-request. |
| GADRequest | gender | Removed |   |
| GADRequest | birthday | Removed |   |
| GADRequest | +sdkVersion | GADMobileAds.sharedInstance.sdkVersion |   |
| GADRequest | -setBirthdayWithMonth:day:year: | Removed |   |
| GADRequest | -setLocationWithDescription: | -setLocationWithLatitude:longitude:accuracy: |   |
| GADRequest | -tagForChildDirectedTreatment: | \[GADMobileAds.sharedInstance.requestConfiguration tagForChildDirectedTreatment\] |   |
| GADErrorCode | kGADError\* | GADError\* | The `k` prefix is dropped from all error code constants. |
| GADBannerView | hasAutoRefreshed | autoloadEnabled |   |
| GADBannerView | inAppPurchaseDelegate | Removed |   |
| GADBannerView | mediatedAdView | Removed |   |
| GADBannerView | adNetworkClassName | responseInfo.adNetworkClassName |   |
| DFPBannerView | -setValidAdSizesWithSizes: | -setValidAdSizes: |   |
| DFPBannerViewOptions | -adSizeDelegate | Removed |   |
| GADBannerViewDelegate | -adViewDidReceiveAd: | -bannerViewDidReceiveAd: |   |
| GADBannerViewDelegate | -adView:didFailToReceiveAdWithError: | -bannerView:didFailToReceiveAdWithError: |   |
| GADBannerViewDelegate | -adViewWillPresentScreen: | -bannerViewWillPresentScreen: |   |
| GADBannerViewDelegate | -adViewWillDismissScreen: | -bannerViewWillDismissScreen: |   |
| GADBannerViewDelegate | -adViewDidDismissScreen: | -bannerViewDidDismissScreen: |   |
| GADBannerViewDelegate | -adViewWillLeaveApplication: | Removed |   |
| GADNativeCustomTemplateAd | templateID | GADCustomNativeAd.formatID |   |
| GADNativeCustomTemplateAd | -performClickOnAssetWithKey:customClickHandler: | -performClickOnAssetWithKey: |   |
| GADNativeAdImageAdLoaderOptions | preferredImageOrientation | GADNativeAdMediaAdOptions.mediaAspectRatio |   |
| GADInterstitial | inAppPurchaseDelegate | Removed |   |
| GADInterstitial | isReady | Removed | Use canPresentFromRootViewController:error: instead. |
| GADInterstitial | hasBeenUsed | Removed | Use canPresentFromRootViewController:error: instead. |
| GADInterstitial | -init | -initWithAdUnitID: |   |
| GADInterstitial | -setAdUnitID: | -initWithAdUnitID: |   |
| GADInterstitial | adNetworkClassName | responseInfo.adNetworkClassName |   |
| GADInterstitial | -interstitialWillLeaveApplication: | Removed |   |
| GADUnifiedNativeAd | videoController | mediaContent.videoController |   |
| GADUnifiedNativeAd | adNetworkClassName | responseInfo.adNetworkClassName |   |