Guide for migrating to version 6

Other platforms

Warning

Make sure to update your used Yandex mediation adapters and adapters for third-party mediation networks to the latest version. Older versions may cause adapter integration errors that can prevent your ads from being served.

Banners

Renamed the YMAAdSize class to YMABannerAdSize. Removed the flexibleSizeWithCGSize:(CGSize)size and fixedSizeWithCGSize:(CGSize)size methods previously marked as deprecated.

Use methods depending on the ad type:

Use the stickySizeWithContainerWidth:(CGFloat)width method to create an adaptive sticky banner.

That is a small, automatically updated ad placed at the top or bottom of the app screen.

It does not overlap the main app content and is often used in game apps.

The height of a sticky banner is determined automatically, adapting to the screen size of the device and not taking up more than 15% of the screen height.

Warning

Version 6.0.0 added autorefresh support for adaptive sticky banners.

If you have previously implemented autorefresh for sticky banners, disable it.

Use the inlineSizeWithWidth:(CGFloat)width maxHeight:(CGFloat)height method to create an adaptive inline banner.

Adaptive inline banners are a flexible format of banner advertising, providing maximum efficiency by optimizing the ad size on each device.

The height of the banner is adjusted automatically and might reach the device screen height.

Typically, that format is used in feed-based apps or contexts where it's okay to focus primarily on the ad.

For backward compatibility, we added the fixedSizeWithWidth:(CGFloat)width height:(CGFloat)height method instead of fixedSizeWithCGSize:(CGSize)size. We don't recommend using it, however. Use stickySizeWithContainerWidth:(CGFloat)width instead. In SDK 6.0.0, the height of the banner is calculated automatically and known before the ad request is sent. You can use this height in your screen layout.

Removed the deprecated method flexibleSizeWithCGSize:(CGSize)size

SDK 5

let adSize = YMAAdSize.flexibleSize(withCGSize: CGSize(width: screenWidth, height: bannerHeight))

SDK 6

let adSize = YMABannerAdSize.inlineSize(withWidth: screenWidth, maxHeight: bannerHeight)

Removed the deprecated method fixedSizeWithCGSize:(CGSize)size

SDK 5

let adSize = YMAAdSize.fixedSize(with: CGSize(width: screenWidth, height: bannerHeight))

SDK 6

Use the inlineSizeWithWidth:(CGFloat)width maxHeight:(CGFloat)height method if you need to embed your banner in the content.

let adSize = YMABannerAdSize.inlineSize(withWidth: screenWidth, maxHeight: bannerHeight)

Alternatively, you can use the stickySizeWithContainerWidth:(CGFloat)width method if you need to place a banner at the top or bottom of your app screen.

let adSize = YMABannerAdSize.stickySize(withContainerWidth: screenWidth)

Renamed the YMAAdSize class as YMABannerAdSize

SDK 5

let adSize = YMAAdSize.fixedSizeWithWidth(width: screenWidth, height: bannerHeight)

SDK 6

let adSize = YMABannerAdSize.stickySize(withContainerWidth: screenWidth)

Renamed the YMAAdSize class as YMABannerAdSize

SDK 5

let adSize = YMAAdSize.fixedSizeWithWidth(width: screenWidth, height: bannerHeight)

SDK 6

let adSize = YMABannerAdSize.stickySize(withContainerWidth: screenWidth)

Rewarded ads

We changed the approach to creating and loading ads. We now provide the YMARewardedAdLoader loader object, which loads ads, with the YMARewardedAd ad object retrieved by the loader's delegate methods. The internal logic for loading and rendering ads remains the same. To learn more about the new API, see the SDK reference.

SDK 5

final class RewardedAdViewController: UIViewController {
   private lazy var rewardedAd: YMARewardedAd = {
        let rewardedAd = YMARewardedAd(adUnitID: "R-M-XXXXX-YY")
        rewardedAd.delegate = self
        return rewardedAd
    }()

    func loadAd() {
      rewardedAd.load()
    }

    func showAd() {
      rewardedAd.present(from: self)
    }

}

SDK 6

final class RewardedAdViewController: UIViewController {
   private var rewardedAd: YMARewardedAd?
   private lazy var rewardedAdLoader: YMARewardedAdLoader = {
        let loader = YMARewardedAdLoader()
        loader.delegate = self
        return loader
    }()

    func loadAd() {
      let configuration = YMAAdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
      rewardedAdLoader.loadAd(with: configuration)
    }

    func showAd() {
      rewardedAd?.show(from: self)
    }

}

extension RewardedAdViewController: YMARewardedAdLoaderDelegate {
   func rewardedAdLoader(_ adLoader: YMARewardedAdLoader, didLoad rewardedAd: YMARewardedAd) {
        self.rewardedAd = rewardedAd
    }
}

Interstitial advertising

We changed the approach to creating and loading interstitial ads. We now provide the YMAInterstitialAdLoader loader object, which loads ads, with the YMAInterstitialAd ad object retrieved by the loader's delegate methods. The internal logic of ad loading and rendering remains the same. To learn more about the new API, see the SDK reference.

SDK 5

final class InterstitialAdViewController: UIViewController {
   private lazy var interstitialAd: YMAInterstitialAd = {
        let interstitialAd = YMAInterstitialAd(adUnitID: "R-M-XXXXX-YY")
        interstitialAd.delegate = self
        return interstitialAd
    }()

    func loadAd() {
      interstitialAd.load()
    }

    func showAd() {
      interstitialAd.present(from: self)
    }

}

SDK 6

final class InterstitialAdViewController: UIViewController {
   private var interstitialAd: YMAInterstitialAd?
   private lazy var interstitialAdLoader: YMInterstitialAdLoader = {
        let loader = YMInterstitialAdLoader()
        loader.delegate = self
        return loader
    }()

    func loadAd() {
      let configuration = YMAAdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
      interstitialAdLoader.loadAd(with: configuration)
    }

    func showAd() {
      interstitialAd?.show(from: self)
    }

}

extension InterstitialAdViewController: YMAInterstitialAdLoaderDelegate {
   func interstitialAdLoader(_ adLoader: YMAInterstitialAdLoader, didLoad interstitialAd: YMAInterstitialAd) {
        self.interstitialAd = interstitialAd
    }
}

Here you can find the complete examples for integrations:

App open ad

New ad format added: app open ad. To learn more, see App open ads.

Minimum iOS version

Yandex Mobile Ads 6.0 requires iOS 13 or higher. If you run an earlier iOS version, please upgrade to iOS 13.

Yandex mediation

Warning

Make sure to update your used Yandex mediation adapters and adapters for third-party mediation networks to the latest version. Older versions may cause adapter integration errors that can prevent your ads from being served.

New adapter versions

Current versions of Yandex mediation adapters (as of SDK 6.0.0 release):

  • Digital Turbine (ex. AdColony): 4.9.0.5.
  • AppLovin: 11.11.2.0.
  • Chartboost: 9.4.0.0.
  • Google: 10.9.0.0.
  • InMobi: 10.5.5.1.
  • IronSource: 7.4.0.0.
  • Mintegral: 7.4.0.2.
  • VK Ads (ex. myTarget): 5.18.0.1.
  • Start.io: 4.10.0.0.
  • Unity Ads: 4.8.0.1.

Current versions of adapters for third-party mediation platforms (as of SDK 6.0.0 release):

  • Google AdMob (ex. AdMob): 10.9.0.
  • IronSource: 7.4.0.

Renaming the Google AdMob (ex. AdMob) adapter

We renamed the AdMobYandexMobileAdsAdapters adapters as GoogleYandexMobileAdsAdapters. If you use the standardized mediation build, you don't have to do anything. If you add the adapters manually, you need to edit your project's Podfile.

SDK 5

pod 'AdMobYandexMobileAdsAdapters'

SDK 6

pod 'GoogleYandexMobileAdsAdapters'