---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/ios/release/8-0-0-migration.md
  - https://ads.yandex.com/helpcenter/ru/dev/ios/release/8-0-0-migration.md
  - https://ads.yandex.com/helpcenter/zh/dev/ios/release/8-0-0-migration.md
  - href: en/dev/ios/release/8-0-0-migration.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

<!--
Используется в Boost: boost/ru/ad-monetization/dev/ios
-->

# Guide for migrating to version 8

Yandex Mobile Ads SDK 8.0.0 introduces multiple API changes aimed at improving the developer experience.

{% note info "" %}

For Objective-C projects, see [Section 14](#main-actor) (MainActor) to ensure proper handling of MainActor-isolated classes. Perform operations with these classes on the main thread.

{% endnote %}

{% note tip "AI-assisted migration" %}

To speed up the migration from SDK 7.x to 8.x, use the ready-made migration skill for AI assistants — see the [AI-assisted migration](#ai) section for details.

{% endnote %}

## Key changes

### 1. Changes to AdRequest

- Use `AdRequest` for all ad formats.
- The `AdRequestConfiguration` and `NativeAdRequestConfiguration` classes and all mutable request classes have been removed.
- The `adUnitID` property is now passed as a required parameter during `AdRequest` initialization.

#|
|| **Class** | **Status** ||
|| `AdRequestConfiguration` | Removed. Use `AdRequest`. ||
|| `NativeAdRequestConfiguration` | Removed. Use `AdRequest` and `NativeAdOptions`. ||
|| `MutableAdRequest` | Removed ||
|| `MutableAdRequestConfiguration` | Removed ||
|| `MutableNativeAdRequestConfiguration` | Removed ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let configuration = AdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
  loader.loadAd(with: configuration)
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let request = AdRequest(adUnitID: "R-M-XXXXX-YY") loader.loadAd(with: request) { … }
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  YMAAdRequestConfiguration *configuration =
      [[YMAAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  [loader loadAdWithConfiguration:configuration];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMAAdRequest *request =
      [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  [loader loadAdWithRequest:request
         completionHandler:^(YMAInterstitialAd * _Nullable ad,
                             NSError * _Nullable error) {
      if (ad) {
          // ad loaded
      } else {
          // load error
      }
  }];
  ```
  ||
  |#

{% endlist %}

### 2. Changes to Targeting

- The fields `age`, `gender`, `location`, `contextQuery`, and `contextTags` have been removed from `AdRequest`.
- To manage the targeting parameters, use the new `AdTargeting` class.

{% note info "" %}

The `AdTargetInfo` class has been renamed to `AdTargeting`, and the `targetInfo` field within `AdRequestTokenConfiguration` and `BidderTokenRequestConfiguration` has been renamed to `targeting`.

{% endnote %}

#|
|| **Class**  | **Status** ||
|| `AdTargetInfo` | Renamed to `AdTargeting` ||
|#

#|
|| **Class** | **Property** | **Status** ||
|| `AdRequest` | `age` | Removed. Use `AdTargeting.age`. ||
|| ^ | `gender` | Removed. Use `AdTargeting.gender`. ||
|| ^ | `location` | Removed. Use `AdTargeting.location`. ||
|| ^ | `contextQuery` | Removed. Use `AdTargeting.contextQuery`. ||
|| ^ | `contextTags` | Removed. Use `AdTargeting.contextTags`. ||
|| ^ | `targeting` | Added ||
|| `AdTargeting` |  `targetInfo` | Renamed to `targeting` ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let request = AdRequest(
      adUnitID: "R-M-XXXXX-YY",
      age: 25,
      gender: kYMAGenderMale,
      location: location
  )
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let targeting = AdTargeting(
      age: 25,
      gender: .male,
      location: location
  )
  let request = AdRequest(adUnitID: "R-M-XXXXX-YY", targeting: targeting)
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  YMAAdRequest *request = [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
                                                             age:@(25)
                                                          gender:kYMAGenderMale
                                                        location:location];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMAAdTargeting *targeting = [[YMAAdTargeting alloc] initWithAge:@(25)
                                                           gender:YMAGender.male
                                                         location:location
                                                     contextQuery:nil
                                                      contextTags:nil];
  YMAAdRequest *request = [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
                                                        targeting:targeting];
  ```
  ||
  |#

{% endlist %}

### 3. Changes to ad loaders

- Load delegates have been removed. The load result is now delivered via a `completion` handler.
- Pass the `adUnitID` parameter via `AdRequest`.

#|
|| **Class** | **Loader** | **Status** ||
|| `AppOpenAdLoader` | `loadAd(with:)` + delegate | Replaced with `loadAd(with:completion:)` ||
|| `InterstitialAdLoader` | `loadAd(with:)` + delegate | Replaced with `loadAd(with:completion:)` ||
|| `RewardedAdLoader` | `loadAd(with:)` + delegate | Replaced with `loadAd(with:completion:)` ||
|| `NativeAdLoader` | `loadAd(with:)` + delegate | Replaced with `loadAd(with:options:completion:)` ||
|| `NativeBulkAdLoader` | `loadAds(with:adsCount:)` + delegate | Replaced with `loadAds(with:adsCount:options:completion:)` ||
|| `SliderAdLoader` | `loadAd(with:)` + delegate | Replaced with `loadAd(with:options:completion:)`||
|#

#|
|| **Class** | **Status** ||
|| `AppOpenAdLoaderDelegate` | Removed ||
|| `InterstitialAdLoaderDelegate`| ^ ||
|| `RewardedAdLoaderDelegate`| ^ ||
|| `NativeAdLoaderDelegate`| ^ ||
|| `NativeBulkAdLoaderDelegate` | ^ ||
|| `SliderAdLoaderDelegate` | ^ ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  // Interstitial Ads
  let configuration = AdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
  interstitialAdLoader.delegate = self
  interstitialAdLoader.loadAd(with: configuration)

  // Native Ads
  let nativeConfiguration = NativeAdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
  nativeAdLoader.delegate = self
  nativeAdLoader.loadAd(with: nativeConfiguration)
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  // Interstitial Ads
  let request = AdRequest(adUnitID: "R-M-XXXXX-YY")
  interstitialAdLoader.loadAd(with: request) { result in
      switch result {
      case .success(let ad):
          // ad loaded
      case .failure(let error):
          // load error
      }
  }

  // Native Ads
  let options = NativeAdOptions()
  nativeAdLoader.loadAd(with: request, options: options) { result in
      switch result {
      case .success(let ad):
          // ad loaded
      case .failure(let error):
          // load error
      }
  }
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  // Interstitial Ads
  YMAAdRequestConfiguration *configuration =
      [[YMAAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  interstitialAdLoader.delegate = self;
  [interstitialAdLoader loadAdWithConfiguration:configuration];

  // Native Ads
  YMANativeAdRequestConfiguration *nativeConfig =
      [[YMANativeAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  nativeAdLoader.delegate = self;
  [nativeAdLoader loadAdWithConfiguration:nativeConfig];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  // Interstitial Ads
  YMAAdRequest *request =
      [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  [interstitialAdLoader loadAdWithRequest:request
                        completionHandler:^(YMAInterstitialAd * _Nullable ad,
                                            NSError * _Nullable error) {
      if (ad) {
          // ad loaded
      } else {
          // load error
      }
  }];

  // Native Ads
  YMANativeAdOptions *options = [[YMANativeAdOptions alloc] init];
  [nativeAdLoader loadAdWithRequest:request
                            options:options
                  completionHandler:^(id<YMANativeAd> _Nullable ad,
                                      NSError * _Nullable error) {
      if (ad) {
          // ad loaded
      } else {
          // load error
      }
  }];
  ```
  ||
  |#

{% endlist %}

### 3.1 Support for structured concurrency

All ad loaders now support Swift structured concurrency (async/await).

#|
|| **Loader** | **Method** | **Status** ||
|| `AppOpenAdLoader` | `loadAd(with:)` | Added ||
|| `InterstitialAdLoader` | `loadAd(with:)` | ^ ||
|| `RewardedAdLoader` | `loadAd(with:)` | ^ ||
|| `NativeAdLoader` | `loadAd(with:options:)` | ^ ||
|| `NativeBulkAdLoader` | `loadAds(with:adsCount:options:)` | ^ ||
|| `SliderAdLoader` | `loadAd(with:options:)` | ^ ||
|#

#### Examples

{% list tabs %}

- Swift

  ```swift
  let request = AdRequest(adUnitID: "R-M-XXXXX-YY")

  // Interstitial Ads
  let interstitialAd = try await interstitialAdLoader.loadAd(with: request)

  // Rewarded Ads
  let rewardedAd = try await rewardedAdLoader.loadAd(with: request)

  // AppOpen Ads
  let appOpenAd = try await appOpenAdLoader.loadAd(with: request)

  // Native Ads
  let options = NativeAdOptions()
  let nativeAd = try await nativeAdLoader.loadAd(with: request, options: options)

  // Slider Ads
  let sliderAd = try await sliderAdLoader.loadAd(with: request, options: options)

  // Native Bulk Ads
  let nativeAds = try await nativeBulkAdLoader.loadAds(with: request, adsCount: 3, options: options)
  ```

- Objective-C

  *Structured concurrency is supported only for Swift.*

{% endlist %}

### 4. Changes to the Banner API

- The `AdView` class has been renamed to `BannerAdView` and the `AdViewDelegate` protocol has been renamed to `BannerAdViewDelegate`.
- `BannerAdView` no longer includes the `adUnitID` property, Pass `adUnitID` to the `AdRequest` builder before each ad load.
- `BannerAdSize` factory methods have been renamed.

#|
|| **Class** | **Status** ||
|| `AdView` | Renamed to `BannerAdView` ||
|| `AdViewDelegate` | Renamed to `BannerAdViewDelegate` ||
|#

#|
|| **Class** | **Property** | **Status** ||
|| `BannerAdView` | `adViewDidLoad` | Renamed to `bannerAdViewDidLoad`  ||
|| ^ | `adViewDidFailLoading` | Renamed to `bannerAdViewDidFailLoading`  ||
|| ^ | `adViewDidClick` | Renamed to `bannerAdViewDidClick` ||
|| ^ | `adView(_:didTrackImpression:)` | Renamed to `bannerAdView(_:didTrackImpression:)` ||
|| ^ | `AdView(adUnitID:adSize:)` | Replaced with `BannerAdView(adSize:)` ||
|| ^ | `AdView.adUnitID` | Replaced with `BannerAdView.adInfo?.adUnitID` ||
|| ^ | `AdView.loadAd()` |  Removed ||
|| ^ | `AdView.loadAd(with: AdRequest?)` | Replaced with `BannerAdView.loadAd(with: AdRequest)` ||
|| `BannerAdSize` | `fixedSize(withWidth:height:)` | Renamed to `fixed(width:height:)` ||
|| ^ | `inlineSize(withWidth:maxHeight:)` | Renamed to `inline(width:maxHeight:)` ||
|| ^ | `stickySize(withContainerWidth:)` | Renamed to `sticky(containerWidth:)` ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let adSize = BannerAdSize.stickySize(withContainerWidth: screenWidth)
  let adView = AdView(adUnitID: "R-M-XXXXX-YY", adSize: adSize)
  adView.delegate = self
  adView.loadAd()
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let adSize = BannerAdSize.sticky(containerWidth: screenWidth)
  let bannerAdView = BannerAdView(adSize: adSize)
  bannerAdView.delegate = self
  let request = AdRequest(adUnitID: "R-M-XXXXX-YY")
  bannerAdView.loadAd(with: request)
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  YMABannerAdSize *adSize = [YMABannerAdSize stickySizeWithContainerWidth:screenWidth];
  YMAAdView *adView = [[YMAAdView alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
                                                   adSize:adSize];
  adView.delegate = self;
  [adView loadAd];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMABannerAdSize *adSize = [YMABannerAdSize stickyWithContainerWidth:screenWidth];
  YMABannerAdView *bannerAdView = [[YMABannerAdView alloc] initWithAdSize:adSize];
  bannerAdView.delegate = self;
  YMAAdRequest *request = [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
  [bannerAdView loadAdWithRequest:request];
  ```
  ||
  |#

{% endlist %}

### 5. Changes to AdInfo

- Some ad object properties have been removed: `info`, `adAttributes`, `creativeID`, and `campaignID`.
- Use `adInfo`. Some `adInfo` properties have been renamed.

#|
|| **Class** | **Property** |  **Status** ||
|| `AdInfo` | `adUnitId` | Renamed to `adUnitID` ||
|| ^ | `data` | Renamed to `extraData` ||
|| ^ | `adSize` | Removed ||
|| ^ | `partnerText` | Added ||
|| `BannerAdView`,<br>`NativeAd`,<br>`SliderAd`,<br>`AppOpenAd`,<br>`InterstitialAd`,<br>`RewardedAd` | `info` | Replaced with `adInfo.extraData` ||
|| ^ | `adAttributes` | Replaced with `adInfo.creatives`  ||
|| ^ | `creativeID` | Replaced with `adInfo.creatives[i].creativeID`  ||
|| ^ | `campaignID` | Replaced with `adInfo.creatives[i].campaignID`  ||
|| `Creative` | `placeID` | Added   ||
|| ^ | `offerID` | Added  ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  // adAttributes and info
  let attributes = nativeAd.adAttributes
  let info = nativeAd.info

  // creativeID and campaignID
  let creativeID = interstitialAd.creativeID
  let campaignID = interstitialAd.campaignID

  // adUnitId
  let adUnitId = interstitialAd.adInfo.adUnitId

  // adSize (available)
  let size = bannerAdView.adInfo.adSize
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  // adInfo.creatives and adInfo.extraData
  let creatives = nativeAd.adInfo.creatives
  let extraData = nativeAd.adInfo.extraData

  // creativeID, campaignID, placeID, offerID via creatives
  if let creative = interstitialAd.adInfo.creatives.first {
      let creativeID = creative.creativeID
      let campaignID = creative.campaignID
      let placeID = creative.placeID
      let offerID = creative.offerID
  }

  // adUnitID (renamed)
  let adUnitID = interstitialAd.adInfo.adUnitID

  // partnerText (new)
  let partnerText = interstitialAd.adInfo.partnerText

  // adSize deleted — the banner size is available in BannerAdView.adSize
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  // adAttributes and info
  NSArray *attributes = nativeAd.adAttributes;
  NSDictionary *info = nativeAd.info;

  // creativeID and campaignID
  NSString *creativeID = interstitialAd.creativeID;
  NSString *campaignID = interstitialAd.campaignID;

  // adUnitId
  NSString *adUnitId = interstitialAd.adInfo.adUnitId;

  // adSize (available)
  YMAAdSize *size = bannerAdView.adInfo.adSize;
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  // adInfo.creatives and adInfo.extraData
  NSArray<YMACreative *> *creatives = nativeAd.adInfo.creatives;
  NSDictionary *extraData = nativeAd.adInfo.extraData;

  // creativeID, campaignID, placeID, offerID via creatives
  YMACreative *creative = interstitialAd.adInfo.creatives.firstObject;
  if (creative != nil) {
      NSString *creativeID = creative.creativeID;
      NSString *campaignID = creative.campaignID;
      NSString *placeID = creative.placeID;
      NSString *offerID = creative.offerID;
  }

  // adUnitID (renamed)
  NSString *adUnitID = interstitialAd.adInfo.adUnitID;

  // partnerText (new)
  NSString *partnerText = interstitialAd.adInfo.partnerText;

  // adSize deleted — the banner size is available in YMABannerAdView.adSize
  ```
  ||
  |#

{% endlist %}

### 6. Changes to the main SDK class

- The `MobileAds` class has been renamed to `YandexAds`.
- Privacy methods and properties have been renamed and moved to a new class.

#|
|| **Class** | **Status** ||
|| `MobileAds` | Renamed to `YandexAds` ||
|| `MobileAds.sdkVersion` | Replaced with `YandexAds.sdkVersion.stringValue` ||
|| `MobileAds.setLocationTrackingEnabled(_:)` | Renamed to `YandexAds.setLocationTracking(_:)` ||
|| `MobileAds.setAgeRestrictedUser(_:)` | Renamed to `YandexAds.setAgeRestricted(_:)` ||
|| `MobileAds.setUserConsent(_:)` | Moved to `YandexAds.setUserConsent(_:)` ||
|| `YMANativeAdView` | Renamed to `NativeAdView` ||
|| `YMANativeMediaView` | Renamed to `NativeMediaView` ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  import YandexMobileAds
  MobileAds.setLocationTrackingEnabled(true)
  MobileAds.setAgeRestrictedUser(false)
  MobileAds.setUserConsent(true)
  let version = MobileAds.sdkVersion
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  import YandexMobileAds
  YandexAds.setLocationTracking(true)
  YandexAds.setAgeRestricted(false)
  YandexAds.setUserConsent(true)
  let version = YandexAds.sdkVersion.stringValue
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  [YMAMobileAds setLocationTrackingEnabled:YES];
  [YMAMobileAds setAgeRestrictedUser:NO];
  [YMAMobileAds setUserConsent:YES];
  NSString *version = YMAMobileAds.sdkVersion;
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  [YMAYandexAds setLocationTracking:YES];
  [YMAYandexAds setAgeRestricted:NO];
  [YMAYandexAds setUserConsent:YES];
  NSString *version = YMAYandexAds.sdkVersion.stringValue;
  ```
  ||
  |#

{% endlist %}

### 7. Changes to ad object delegates

The delegate methods `AppOpenAdDelegate`, `InterstitialAdDelegate`, `RewardedAdDelegate`, `NativeAdDelegate`, and `SliderAdDelegate` are no longer optional, and all of them must be implemented.

#### Show methods

#|
|| **Class** | **Method** | **Status** ||
|| `RewardedAdDelegate` |
```
rewardedAdDelegate(
  _:didFailToShowWithError:)
```
| Renamed to
```
rewardedAdDelegate(
  _:didFailToShow:)
```
||
|| `InterstitialAdDelegate` |
```
interstitialAdDelegate(
  _:didFailToShowWithError:)
```
| Renamed to
```
interstitialAdDelegate(
  _:didFailToShow:)
```
||
|| `AppOpenAdDelegate` |
```
appOpenAdDelegate(
  _:didFailToShowWithError:)
```
| Renamed to

```
appOpenAdDelegate(
  _:didFailToShow:)
``` ||
|#

#### Impression tracking methods

#|
|| **Class** | **Method** |  **Status** ||
|| `NativeAdDelegate` |
```
nativeAd(
  _:didTrackImpressionWith:)
```
| Renamed to
```
nativeAd(
  _:didTrackImpression:)
```
||
|| `RewardedAdDelegate` |
```
rewardedAdDelegate(
  _:didTrackImpressionWith:)
```
| Renamed to
```
rewardedAdDelegate(
  _:didTrackImpression:)
```
||
|| `InterstitialAdDelegate` |
```
interstitialAdDelegate(
  _:didTrackImpressionWith:)
```
| Renamed to
```
interstitialAdDelegate(
  _:didTrackImpression:)
```
||
|| `AppOpenAdDelegate` |
```
appOpenAdDelegate(
  _:didTrackImpressionWith:)
```
| Renamed to
```
appOpenAdDelegate(
  _:didTrackImpression:)
```
||
|| `SliderAdDelegate` |
```
sliderAdDelegate(
  _:didTrackImpressionWith:)
```
| Renamed to
```
sliderAdDelegate(
  _:didTrackImpression:)
```
||
|#

#### Removed delegate methods

#|
|| **Delegate** | **Method** | **Status** ||
|| `AdViewDelegate` | `close(_:)` | Removed ||
|| ^ | `viewControllerForPresentingModalView()` | ^ ||
|| ^ | `adViewWillLeaveApplication` | ^ ||
|| ^ | `adView(_:willPresentScreen:)` | ^ ||
|| ^ | `adView(_:didDismissScreen:)` | ^ ||
|| `NativeAdDelegate` | `close(_:)` | ^ ||
|| ^ | `viewControllerForPresentingModalView()` | ^ ||
|| ^ | `nativeAdWillLeaveApplication` | ^ ||
|| ^ | `nativeAd(_:willPresentScreen:)` | ^ ||
|| ^ | `nativeAd(_:didDismissScreen:)` | ^ ||
|| `SliderAdDelegate` | `sliderAdDidClose(_:)` | ^ ||
|| ^ | `sliderAdWillLeaveApplication` | ^ ||
|| ^ | `sliderAd(_:willPresentScreen:)` | ^ ||
|| ^ | `sliderAd(_:didDismissScreen:)` | ^ ||
|#

### 8. Changes to Native Ads: Warning

- The`warning` field type within `NativeAdAssets` has been changed from `String?` to `NativeAdWarning?`.
- `NativeAdWarning` now features a new field: `minimumRequiredArea`. This field specifies the minimum area of the ad that must be allocated to the `warning` asset.

#|
|| **Class** | **Field** | **Status** ||
|| `NativeAdAssets` | `warning: String?` | Field type was changed to `warning: NativeAdWarning?` ||
|| `NativeAdWarning` | `value: String` | Added  ||
|| ^ | `minimumRequiredArea: Double` | Added  ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let warningText: String? = nativeAd.adAssets.warning
  label.text = warningText
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let warning: NativeAdWarning? = nativeAd.adAssets.warning
  label.text = warning?.value
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  NSString *warningText = nativeAd.adAssets.warning;
  label.text = warningText;
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMANativeAdWarning *warning = nativeAd.adAssets.warning;
  label.text = warning.value;
  ```
  ||
  |#

{% endlist %}

### 9. Changes to Native Ads: Media

`NativeAdMedia` now includes a new property: `hasVideo`.

#|
|| **Class** | **Property** | **Status** ||
|| `NativeAdMedia` | `hasVideo: Bool` | Added ||
|#

#### Examples

{% list tabs %}

- Swift

  ```swift
  // SDK 8
  if let media = nativeAd.adAssets.media, media.hasVideo {
      // Consider video content in ads
  }
  ```

- Objective-C

  ```objc
  // SDK 8
  if (nativeAd.adAssets.media != nil && nativeAd.adAssets.media.hasVideo) {
      // Consider video content in ads
  }
  ```

{% endlist %}

### $10. Changes to NativeAd and SliderAd: loadImages

- The `loadImages()` method has been renamed to `loadImages(completionHandler:)`.
- The `NativeAdImageLoadingObserver` protocol has been replaced with the `completionHandler` parameter.
- We've added an asynchronous version of `loadImages()`.

#|
|| **Class** | **Status** ||
|| `NativeAdImageLoadingObserver` |  Removed ||
|#

#|
|| **Class** | **Method** | **Status** ||
|| `NativeAd` | `loadImages()` + `NativeAdImageLoadingObserver` | Replaced with `loadImages(completionHandler:)` / `loadImages()` (async)  ||
|| `SliderAd` | `loadImages()` + `NativeAdImageLoadingObserver` | Replaced with `loadImages(completionHandler:)` / `loadImages()` (async)  ||
|#

**Applicable to** `NativeAd` and `SliderAd`.

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  // NativeAd
  nativeAd.addImageLoadingObserver(self)
  nativeAd.loadImages()

  // SliderAd
  sliderAd.addImageLoadingObserver(self)
  sliderAd.loadImages()
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  // NativeAd (completion handler)
  nativeAd.loadImages { [weak self] in
      // resources loaded
  }

  // NativeAd (async/await)
  await nativeAd.loadImages()

  // SliderAd (completion handler)
  sliderAd.loadImages { [weak self] in
      // resources loaded
  }

  // SliderAd (async/await)
  await sliderAd.loadImages()
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  // NativeAd
  [nativeAd addImageLoadingObserver:self];
  [nativeAd loadImages];

  // SliderAd
  [sliderAd addImageLoadingObserver:self];
  [sliderAd loadImages];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  // NativeAd
  [nativeAd loadImagesWithCompletionHandler:^{
      // resources loaded
  }];

  // SliderAd
  [sliderAd loadImagesWithCompletionHandler:^{
      // resources loaded
  }];
  ```
  ||
  |#

{% endlist %}

### 11. Removing VideoController

The `videoController` property and associated classes (`VideoController` and `VideoDelegate`) have been removed.

#|
|| **Property** | **Status** ||
|| `AdView.videoController`  | Removed ||
|| `BannerAdView.videoController`  | ^ ||
|| `VideoController` | ^ ||
|| `VideoDelegate` | ^ ||
|#

### 12. Removing native templates

Native templates have been completely removed. All associated classes are no longer available.

#|
|| **Template**| **Status** ||
|| `NativeTemplateAppearance` | Removed ||
|| `MutableNativeTemplateAppearance` | ^ ||
|| `NativeTemplateHorizontalOffset`  | ^ ||
|| `NativeBannerView`  | ^ ||
|| `ButtonAppearance` | ^ ||
|| `MutableButtonAppearance`  | ^ ||
|| `ImageAppearance`  | ^ ||
|| `MutableImageAppearance` | ^ ||
|| `LabelAppearance`  | ^ ||
|| `MutableLabelAppearance` | ^ ||
|| `RatingAppearance`  | ^ ||
|| `MutableRatingAppearance`  | ^ ||
|| `SizeConstraint` | ^ ||
|| `MutableSizeConstraint`  | ^ ||
|| `SizeConstraintType` | ^ ||
|| `YMAHorizontalOffset`  | ^ ||
|#

### 13. Removed constants and error types

#|
|| **Constants and error types**| **Status** ||
|| `kYMAAdsErrorDomain` | Removed ||
|| `kYMANativeAdErrorDomain`  | Removed ||
|| `kYMAGenderFemale`, `kYMAGenderMale` | Replaced with the `Gender` class ||
|| Constants from `YMAVersion` | Replaced with `YandexAds.sdkVersion.stringValue` ||
|| `MobileAds.sdkVersion` | Replaced with `YandexAds.sdkVersion.stringValue`  ||
|| `AdErrorCode` | Removed ||
|| `NativeErrorCode` | Removed ||
|| `Version.prereleaseIdentifiers`  | Removed ||
|| `Version.buildMetadataIdentifiers` | Removed ||
|| `isYandexMobileAdsError` (on `Error`/`NSError`) | Removed ||
|| `isYandexMobileNativeAdsError` (on `Error`/`NSError`)| Removed ||
|#

### 14. Swift 6, MainActor, and Sendable {#main-actor}

- The SDK is built using Swift 6.
- Some classes and protocols are now `MainActor`-isolated, and one protocol requires `Sendable`.

#### MainActor-isolated classes

#|
|| **Class** ||
|| `AppOpenAd` ||
|| `InterstitialAd` ||
|| `RewardedAd` ||
|| `AudioSessionManager` ||
|| `NativeVideoPlaybackControls` ||
|#

#### MainActor-isolated protocols

#|
|| **Protocol** ||
|| `AppOpenAdDelegate` ||
|| `InterstitialAdDelegate` ||
|| `RewardedAdDelegate` ||
|| `NativeAd` ||
|| `NativeAdDelegate` ||
|| `SliderAd` ||
|| `SliderAdDelegate` ||
|| `BannerAdViewDelegate` ||
|#

The `NativeAdImageLoadingObserver` protocol has been removed. Image loading is now handled via a completion handler or async/await.

### 15. Other changes

#|
|| **Class** | **Object** | **Status** ||
|| `Rating` | `setRating(_:)` / `rating()` | Replaced with the `Rating.rating` property ||
|| `NativeAd` | `bind(toSliderView:)` | Moved to `SliderAd.bind(with:)` ||
|| `NativeVideoPlaybackProgressControl` | `reset` | Removed ||
|| `MobileAds` | `audioSessionManager()` | Replaced with the `YandexAds.audioSessionManager` property ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  rating.setRating(4.5)
  let value = rating.rating()

  let audioManager = MobileAds.audioSessionManager()
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  rating.rating = 4.5

  let audioManager = YandexAds.audioSessionManager
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  [rating setRating:4.5];
  CGFloat value = [rating rating];

  YMAAudioSessionManager *audioManager = [YMAMobileAds audioSessionManager];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  rating.rating = 4.5;

  YMAAudioSessionManager *audioManager = YMAYandexAds.audioSessionManager;
  ```
  ||
  |#

{% endlist %}

## Changes to the mediation networks API

### 1. Changes to AdapterIdentity for mediation adapters

- You can now set the identity of mediation adapters via `AdapterIdentity`.
- The `mediationNetworkName` parameter is no longer used.
- Set the adapter identity globally via `YandexAds.setAdapterIdentity(_:)` before SDK initialization.

#|
|| **Class** | **Parameter** | **Status** ||
|| `BidderTokenLoader` | `BidderTokenLoader(mediationNetworkName:)` | Replaced with `BidderTokenLoader()` ||
|| `YandexAds` | `MobileAds.initialize()` | Replaced with `YandexAds.setAdapterIdentity(_:)` + `YandexAds.initializeSDK()` ||
|| `AdapterIdentity` |
```
AdapterIdentity(
  adapterNetworkName:adapterVersion:adapterNetworkVersion:)
```
| Added ||
|#

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let tokenLoader = BidderTokenLoader(mediationNetworkName: "AdMob")
  let config = BidderTokenRequestConfiguration(adType: .interstitial)
  tokenLoader.loadBidderToken(requestConfiguration: config) { ... }

  MobileAds.initialize()
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let tokenLoader = BidderTokenLoader()
  let request = BidderTokenRequest.interstitial()
  tokenLoader.loadBidderToken(request: request) { ... }

  let adapterIdentity = AdapterIdentity(
      adapterNetworkName: "AdMob",
      adapterVersion: "1.0.0",
      adapterNetworkVersion: "23.5.0"
  )
  YandexAds.setAdapterIdentity(adapterIdentity)
  YandexAds.initializeSDK()
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  YMABidderTokenLoader *tokenLoader =
      [[YMABidderTokenLoader alloc] initWithMediationNetworkName:@"AdMob"];
  YMABidderTokenRequestConfiguration *config =
      [[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeInterstitial];
  [tokenLoader loadBidderTokenWithRequestConfiguration:config
                                   completionHandler:^(NSString *token) { ... }];

  [YMAMobileAds initialize];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMABidderTokenLoader *tokenLoader = [[YMABidderTokenLoader alloc] init];
  YMABidderTokenRequest *request = [YMABidderTokenRequest interstitial];
  [tokenLoader loadBidderTokenWithRequest:request
                        completionHandler:^(NSString *token) { ... }];

  YMAAdapterIdentity *identity =
      [[YMAAdapterIdentity alloc] initWithAdapterNetworkName:@"AdMob"
                                             adapterVersion:@"1.0.0"
                                      adapterNetworkVersion:@"23.5.0"];
  [YMAYandexAds setAdapterIdentity:identity];
  [YMAYandexAds initializeSDK];
  ```
  ||
  |#

{% endlist %}

### 2. Changes to BidderTokenRequest

- The `BidderTokenRequestConfiguration` class has been renamed to `BidderTokenRequest`.
- The initializer and public properties (`targetInfo`, `bannerAdSize`, and `parameters`) have been moved to factory method parameters.

#|
|| **Class** | **Status** ||
|| `BidderTokenRequestConfiguration` | Renamed to `BidderTokenRequest` ||
|#

#|
|| **Class** | **Property** | **Status** ||
|| `BidderTokenRequestConfiguration` | `init(adType: .banner)` + `.bannerAdSize` | Replaced with
```
BidderTokenRequest.banner(
  size:targeting:parameters:)
```
||
|| `BidderTokenRequestConfiguration` | `init(adType: .interstitial)` + `.targetInfo` | Replaced with
```
BidderTokenRequest.interstitial(
  targeting:parameters:)
```
||
|| `BidderTokenRequestConfiguration` | `init(adType: .rewarded)` + `.targetInfo` | Replaced with
```
BidderTokenRequest.rewarded(
  targeting:parameters:)
```
||
|| `BidderTokenRequestConfiguration` | `init(adType: .native)` + `.targetInfo` | Replaced with
```
BidderTokenRequest.native(
  targeting:parameters:)
```
||
|| `BidderTokenRequestConfiguration` | `init(adType: .appOpenAd)` + `.targetInfo` | Replaced with
```
BidderTokenRequest.appOpenAd(
  targeting:parameters:)
```
||
|| `BidderTokenLoader` |
```
loadBidderToken(
  requestConfiguration:completionHandler:)
```
| Renamed to
```
loadBidderToken(
  request:completionHandler:)
```
||
|#

**Applicable to** mediation adapters that use `BidderTokenLoader`.

#### Examples

{% list tabs %}

- Swift

  #|
  || **SDK 7** ||
  ||
  ```swift
  let config = BidderTokenRequestConfiguration(adType: .banner)
  config.bannerAdSize = adSize
  config.targetInfo = adTargetInfo
  tokenLoader.loadBidderToken(requestConfiguration: config) { ... }
  ```
  ||

  || **SDK 8** ||
  ||
  ```swift
  let targeting = AdTargeting()
  let request = BidderTokenRequest.banner(
      size: adSize,
      targeting: targeting,
      parameters: ["key": "value"]
  )
  tokenLoader.loadBidderToken(request: request) { ... }

  // Other ad formats:
  let interstitialRequest = BidderTokenRequest.interstitial()
  let rewardedRequest = BidderTokenRequest.rewarded()
  let nativeRequest = BidderTokenRequest.native()
  let appOpenRequest = BidderTokenRequest.appOpenAd()
  ```
  ||
  |#

- Objective-C

  #|
  || **SDK 7** ||
  ||
  ```objc
  YMABidderTokenRequestConfiguration *config =
      [[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeBanner];
  config.bannerAdSize = adSize;
  config.targetInfo = adTargetInfo;
  [tokenLoader loadBidderTokenWithRequestConfiguration:config
                                   completionHandler:^(NSString *token) { ... }];
  ```
  ||

  || **SDK 8** ||
  ||
  ```objc
  YMAAdTargeting *targeting = [[YMAAdTargeting alloc] initWithAge:nil
                                                           gender:nil
                                                         location:nil
                                                     contextQuery:nil
                                                      contextTags:nil];
  YMABidderTokenRequest *request = [YMABidderTokenRequest bannerWithSize:adSize
                                                                 targeting:targeting
                                                               parameters:@{@"key": @"value"}];
  [tokenLoader loadBidderTokenWithRequest:request
                        completionHandler:^(NSString *token) { ... }];

  // Other ad formats:
  YMABidderTokenRequest *interstitialRequest = [YMABidderTokenRequest interstitial];
  YMABidderTokenRequest *rewardedRequest = [YMABidderTokenRequest rewarded];
  YMABidderTokenRequest *nativeRequest = [YMABidderTokenRequest native];
  YMABidderTokenRequest *appOpenRequest = [YMABidderTokenRequest appOpenAd];
  ```
  ||
  |#

{% endlist %}

## SwiftUI integration

The API now supports SwiftUI integration. See the SwiftUI section at the end of the iOS documentation menu:

- [Adaptive inline banner](https://ads.yandex.com/helpcenter/en/dev/ios/swiftui/adaptive-inline-banner.md)
- [Adaptive sticky banner](https://ads.yandex.com/helpcenter/en/dev/ios/swiftui/adaptive-sticky-banner.md)
- [Interstitial ads](https://ads.yandex.com/helpcenter/en/dev/ios/swiftui/interstitial.md)
- [Rewarded ads](https://ads.yandex.com/helpcenter/en/dev/ios/swiftui/rewarded.md)
- [App open ads](https://ads.yandex.com/helpcenter/en/dev/ios/swiftui/app-open-ad.md)

## AI-assisted migration {#ai}

To simplify the migration from SDK 7.x to 8.x, you can use AI assistants with a pre-configured migration skill.

### How it works

1. **Download the skill**

The migration skill is available at [GitHub Yandex Ads SDK iOS](https://github.com/yandexmobile/yandex-ads-sdk-ios/tree/master/Skills/migrate-yandex-ads-sdk-from-7-to-8).

- For Claude Desktop

Copy the skill folder to your agent's skills directory, for example:

```bash
cp -r Skills/migrate-yandex-ads-sdk-from-7-to-8 .claude/skills/
```

- For Cursor IDE

Copy the skill folder to your project and reference the `SKILL.md` file using `@`, for example:

```
@migrate-yandex-ads-sdk-from-7-to-8/SKILL.md
```

- Another method: Copy the contents of `SKILL.md` and all related files into the chat with the AI assistant. Note that this may exceed message limits.

2. **Use a prompt**

Once the skill is loaded, use the following prompt in your chat with the AI assistant:

```
Migrate my project from Yandex Mobile Ads SDK 7.x to 8.x
```

{% note warning %}

Always carefully review the AI-generated changes.

Skills help AI assistants handle tasks more effectively, but you must still review all changes made by the agent. AI assistants can make mistakes, so you need to manually review the code.

{% endnote %}

## SKAdNetwork

The SKAdNetwork ID list has been updated, and new tools for automatic updates have been added. For more information on implementation methods and use scenarios, see [SKAdNetwork](https://ads.yandex.com/helpcenter/en/dev/ios/skadnetwork.md).

## Requirements

- **Xcode**: 16.4 or later
- **AppMetricaCore**: 6.0.0 or later
- **AppMetricaLibraryAdapter**: 6.0.0 or later
- **AppMetricaAdSupport**: 6.0.0 or later
- **AppMetricaIDSync**: 6.0.0 or later


