Migration guide to version 8.0.0 (beta)

The new version of Yandex Mobile Ads SDK introduces a number of API changes aimed at improving the developer experience.

Main changes

1. Changes to AdRequest

The AdRequestConfiguration, NativeAdRequestConfiguration, and all Mutable request classes have been removed. Use AdRequest for all ad types. The adUnitID property is now passed as a required initialization parameter of AdRequest.

Class Status
AdRequestConfiguration Removed. Use AdRequest
NativeAdRequestConfiguration Removed. Use AdRequest and NativeAdOptions
MutableAdRequest Removed
MutableAdRequestConfiguration Removed
MutableNativeAdRequestConfiguration Removed

Examples

Swift
SDK 7 SDK 8
let configuration = AdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
loader.loadAd(with: configuration)
let request = AdRequest(adUnitID: "R-M-XXXXX-YY")
loader.loadAd(with: request) { result in
    switch result {
    case .success(let ad):
        // ad loaded
    case .failure(let error):
        // load error
    }
}
Objective-C
SDK 7 SDK 8
YMAAdRequestConfiguration *configuration =
    [[YMAAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
[loader loadAdWithConfiguration:configuration];
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
    }
}];

2. Changes to Targeting

The age, gender, location, contextQuery, and contextTags fields have been removed from AdRequest. Use the new AdTargeting class to manage targeting parameters.

Note: The AdTargetInfo class has been renamed to AdTargeting, the targetInfo field in AdRequestTokenConfiguration and BidderTokenRequestConfiguration has been renamed to targeting.

Class Property Status
AdRequest age Removed. Use AdTargeting.age
AdRequest gender Removed. Use AdTargeting.gender
AdRequest location Removed. Use AdTargeting.location
AdRequest contextQuery Removed. Use AdTargeting.contextQuery
AdRequest contextTags Removed. Use AdTargeting.contextTags
AdTargetInfo Renamed to AdTargeting
targetInfo Renamed to targeting
AdRequest targeting Added
AdTargeting Added

Examples

Swift
SDK 7 SDK 8
let request = AdRequest(
    adUnitID: "R-M-XXXXX-YY",
    age: 25,
    gender: kYMAGenderMale,
    location: location
)
let targeting = AdTargeting(
    age: 25,
    gender: .male,
    location: location
)
let request = AdRequest(adUnitID: "R-M-XXXXX-YY", targeting: targeting)
Objective-C
SDK 7 SDK 8
YMAAdRequest *request = [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
                                                           age:@(25)
                                                        gender:kYMAGenderMale
                                                      location:location];
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];

3. Changes to ad loaders

Load delegates have been removed — the load result is now returned in a completion handler. The adUnitID parameter is now passed via AdRequest.

Class SDK 7 SDK 8 Status
AppOpenAdLoader loadAd(with:) + delegate loadAd(with:completion:) Changed
InterstitialAdLoader loadAd(with:) + delegate loadAd(with:completion:) Changed
RewardedAdLoader loadAd(with:) + delegate loadAd(with:completion:) Changed
NativeAdLoader loadAd(with:) + delegate loadAd(with:options:completion:) Changed
NativeBulkAdLoader loadAds(with:adsCount:) + delegate loadAds(with:adsCount:options:completion:) Changed
SliderAdLoader loadAd(with:) + delegate loadAd(with:options:completion:) Changed
AppOpenAdLoaderDelegate Removed
InterstitialAdLoaderDelegate Removed
RewardedAdLoaderDelegate Removed
NativeAdLoaderDelegate Removed
NativeBulkAdLoaderDelegate Removed
SliderAdLoaderDelegate Removed

Examples

Swift
SDK 7 SDK 8
// 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)
// 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 SDK 8
// 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];
// 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
    }
}];

3.1 Structured Concurrency support

Swift Structured Concurrency (async/await) support has been added to all ad loaders.

Loader Method Status
AppOpenAdLoader loadAd(with:) Added
InterstitialAdLoader loadAd(with:) Added
RewardedAdLoader loadAd(with:) Added
NativeAdLoader loadAd(with:options:) Added
NativeBulkAdLoader loadAds(with:adsCount:options:) Added
SliderAdLoader loadAd(with:options:) Added

Examples

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)

4. Changes to Banner API

The AdView class has been renamed to BannerAdView, the AdViewDelegate protocol to BannerAdViewDelegate. The adUnitID property has been removed from BannerAdView — now adUnitID is passed to the AdRequest constructor before each load. The BannerAdSize factory methods have been renamed.

Class SDK 7 SDK 8 Status
AdView BannerAdView Renamed
AdViewDelegate BannerAdViewDelegate Renamed
BannerAdView adViewDidLoad bannerAdViewDidLoad Renamed
BannerAdView adViewDidFailLoading bannerAdViewDidFailLoading Renamed
BannerAdView adViewDidClick bannerAdViewDidClick Renamed
BannerAdView adView(_:didTrackImpression:) bannerAdView(_:didTrackImpression:) Renamed
BannerAdView AdView(adUnitID:adSize:) BannerAdView(adSize:) Changed
BannerAdView AdView.adUnitID BannerAdView.adInfo?.adUnitID Changed
BannerAdView AdView.loadAd() Removed
BannerAdView AdView.loadAd(with: AdRequest?) BannerAdView.loadAd(with: AdRequest) Changed
BannerAdSize fixedSize(withWidth:height:) fixed(width:height:) Renamed
BannerAdSize inlineSize(withWidth:maxHeight:) inline(width:maxHeight:) Renamed
BannerAdSize stickySize(withContainerWidth:) sticky(containerWidth:) Renamed

Examples

Swift
SDK 7 SDK 8
let adSize = BannerAdSize.stickySize(withContainerWidth: screenWidth)
let adView = AdView(adUnitID: "R-M-XXXXX-YY", adSize: adSize)
adView.delegate = self
adView.loadAd()
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 SDK 8
YMABannerAdSize *adSize = [YMABannerAdSize stickySizeWithContainerWidth:screenWidth];
YMAAdView *adView = [[YMAAdView alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
                                                 adSize:adSize];
adView.delegate = self;
[adView loadAd];
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];

5. Changes to AdInfo

The info, adAttributes, creativeID, campaignID properties of ad objects have been removed. Use adInfo. Some AdInfo property names have also changed.

Class SDK 7 SDK 8 Status
AdInfo adUnitId adUnitID Renamed
AdInfo data extraData Renamed
AdInfo adSize Removed
AdInfo partnerText Added
BannerAdView,
NativeAd,
SliderAd,
AppOpenAd,
InterstitialAd,
RewardedAd
info adInfo.extraData Changed
BannerAdView,
NativeAd,
SliderAd,
AppOpenAd,
InterstitialAd,
RewardedAd
adAttributes adInfo.creatives Changed
BannerAdView,
NativeAd,
SliderAd,
AppOpenAd,
InterstitialAd,
RewardedAd
creativeID adInfo.creatives[i].creativeID Changed
BannerAdView,
NativeAd,
SliderAd,
AppOpenAd,
InterstitialAd,
RewardedAd
campaignID adInfo.creatives[i].campaignID Changed
Creative placeID Added
Creative offerID Added

Examples

Swift
SDK 7 SDK 8
// 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
// 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 removed — banner size is available via BannerAdView.adSize
Objective-C
SDK 7 SDK 8
// 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;
// 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 removed — banner size is available via YMABannerAdView.adSize

6. Changes to the main SDK class

The MobileAds class has been renamed to YandexAds. Privacy methods and properties have been moved to a new class with updated names.

SDK 7 SDK 8 Status
MobileAds YandexAds Renamed
MobileAds.sdkVersion YandexAds.sdkVersion.stringValue Changed
MobileAds.setLocationTrackingEnabled(_:) YandexAds.setLocationTracking(_:) Renamed
MobileAds.setAgeRestrictedUser(_:) YandexAds.setAgeRestricted(_:) Renamed
MobileAds.setUserConsent(_:) YandexAds.setUserConsent(_:) Moved
YMANativeAdView NativeAdView Renamed
YMANativeMediaView NativeMediaView Renamed

Examples

Swift
SDK 7 SDK 8
import YandexMobileAds
MobileAds.setLocationTrackingEnabled(true)
MobileAds.setAgeRestrictedUser(false)
MobileAds.setUserConsent(true)
let version = MobileAds.sdkVersion
import YandexMobileAds
YandexAds.setLocationTracking(true)
YandexAds.setAgeRestricted(false)
YandexAds.setUserConsent(true)
let version = YandexAds.sdkVersion.stringValue
Objective-C
SDK 7 SDK 8
[YMAMobileAds setLocationTrackingEnabled:YES];
[YMAMobileAds setAgeRestrictedUser:NO];
[YMAMobileAds setUserConsent:YES];
NSString *version = YMAMobileAds.sdkVersion;
[YMAYandexAds setLocationTracking:YES];
[YMAYandexAds setAgeRestricted:NO];
[YMAYandexAds setUserConsent:YES];
NSString *version = YMAYandexAds.sdkVersion.stringValue;

7. Changes to ad object delegates

The methods of AppOpenAdDelegate, InterstitialAdDelegate, RewardedAdDelegate, NativeAdDelegate, SliderAdDelegate are no longer optional — all methods are now required to be implemented.

Show methods

Class SDK 7 SDK 8 Status
RewardedAdDelegate rewardedAdDelegate(_:didFailToShowWithError:) rewardedAdDelegate(_:didFailToShow:) Renamed
InterstitialAdDelegate interstitialAdDelegate(_:didFailToShowWithError:) interstitialAdDelegate(_:didFailToShow:) Renamed
AppOpenAdDelegate appOpenAdDelegate(_:didFailToShowWithError:) appOpenAdDelegate(_:didFailToShow:) Renamed

Impression tracking methods

Class SDK 7 SDK 8 Status
NativeAdDelegate nativeAd(_:didTrackImpressionWith:) nativeAd(_:didTrackImpression:) Renamed
RewardedAdDelegate rewardedAdDelegate(_:didTrackImpressionWith:) rewardedAdDelegate(_:didTrackImpression:) Renamed
InterstitialAdDelegate interstitialAdDelegate(_:didTrackImpressionWith:) interstitialAdDelegate(_:didTrackImpression:) Renamed
AppOpenAdDelegate appOpenAdDelegate(_:didTrackImpressionWith:) appOpenAdDelegate(_:didTrackImpression:) Renamed
SliderAdDelegate sliderAdDelegate(_:didTrackImpressionWith:) sliderAdDelegate(_:didTrackImpression:) Renamed

Removed delegate methods

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

8. Changes to Native Ads: Warning

The type of the warning field in NativeAdAssets has changed from String? to NativeAdWarning?. A minimumRequiredArea field has been added to NativeAdWarning, which contains information about the minimum required portion of the ad area for the warning asset.

Class SDK 7 SDK 8 Status
NativeAdAssets warning: String? warning: NativeAdWarning? Type changed
NativeAdWarning value: String Added
NativeAdWarning minimumRequiredArea: Double Added

Examples

Swift
SDK 7 SDK 8
let warningText: String? = nativeAd.adAssets.warning
label.text = warningText
let warning: NativeAdWarning? = nativeAd.adAssets.warning
label.text = warning?.value
Objective-C
SDK 7 SDK 8
NSString *warningText = nativeAd.adAssets.warning;
label.text = warningText;
YMANativeAdWarning *warning = nativeAd.adAssets.warning;
label.text = warning.value;

9. Changes to Native Ads: Media

The hasVideo property has been added to NativeAdMedia.

Class Property Status
NativeAdMedia hasVideo: Bool Added

Examples

Swift
// SDK 8
if let media = nativeAd.adAssets.media, media.hasVideo {
    // Account for the presence of video in the ad
}
Objective-C
// SDK 8
if (nativeAd.adAssets.media != nil && nativeAd.adAssets.media.hasVideo) {
    // Account for the presence of video in the ad
}

10. Changes to NativeAd and SliderAd: loadImages

The loadImages() method has been renamed to loadImages(completionHandler:). The completionHandler parameter replaces the NativeAdImageLoadingObserver observer protocol. An asynchronous version loadImages() has also been added.

Class SDK 7 SDK 8 Status
NativeAd loadImages() + NativeAdImageLoadingObserver loadImages(completionHandler:) / loadImages() (async) Changed
SliderAd loadImages() + NativeAdImageLoadingObserver loadImages(completionHandler:) / loadImages() (async) Changed
NativeAdImageLoadingObserver Removed

Applies to: NativeAd, SliderAd.

Examples

Swift
SDK 7 SDK 8
// NativeAd
nativeAd.addImageLoadingObserver(self)
nativeAd.loadImages()

// SliderAd
sliderAd.addImageLoadingObserver(self)
sliderAd.loadImages()
// 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 SDK 8
// NativeAd
[nativeAd addImageLoadingObserver:self];
[nativeAd loadImages];

// SliderAd
[sliderAd addImageLoadingObserver:self];
[sliderAd loadImages];
// NativeAd
[nativeAd loadImagesWithCompletionHandler:^{
    // resources loaded
}];

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

11. Removal of VideoController

The videoController property and the related VideoController, VideoDelegate classes have been removed.

Class Property/Method Status
AdView / BannerAdView videoController Removed
VideoController Removed
VideoDelegate Removed

12. Removal of native templates

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

Removed classes
NativeTemplateAppearance
MutableNativeTemplateAppearance
NativeTemplateHorizontalOffset
NativeBannerView
ButtonAppearance
MutableButtonAppearance
ImageAppearance
MutableImageAppearance
LabelAppearance
MutableLabelAppearance
RatingAppearance
MutableRatingAppearance
SizeConstraint
MutableSizeConstraint
SizeConstraintType
YMAHorizontalOffset

13. Removed constants and error types

SDK 7 SDK 8 Status
kYMAAdsErrorDomain Removed
kYMANativeAdErrorDomain Removed
kYMAGenderFemale, kYMAGenderMale Gender Replaced by class
Constants from YMAVersion YandexAds.sdkVersion.stringValue Changed
MobileAds.sdkVersion YandexAds.sdkVersion.stringValue Changed
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

The SDK is built using Swift 6. A number of classes and protocols are now isolated to MainActor, 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 handled via a completion handler or async/await.


15. Other changes

Class SDK 7 SDK 8 Status
Rating setRating(_:) / rating() Rating.rating (property) Changed
NativeAd bind(toSliderView:) SliderAd.bind(with:) Moved
NativeVideoPlaybackProgressControl reset Removed
MobileAds audioSessionManager() YandexAds.audioSessionManager (property) Changed

Examples

Swift
SDK 7 SDK 8
rating.setRating(4.5)
let value = rating.rating()

let audioManager = MobileAds.audioSessionManager()
rating.rating = 4.5

let audioManager = YandexAds.audioSessionManager
Objective-C
SDK 7 SDK 8
[rating setRating:4.5];
CGFloat value = [rating rating];

YMAAudioSessionManager *audioManager = [YMAMobileAds audioSessionManager];
rating.rating = 4.5;

YMAAudioSessionManager *audioManager = YMAYandexAds.audioSessionManager;


Changes to mediation network APIs

1. Changes to AdapterIdentity for mediation adapters

A new mechanism for identifying mediation adapters via AdapterIdentity has been added. The mediationNetworkName parameter is no longer used. The adapter identity is set globally via YandexAds.setAdapterIdentity(_:) before SDK initialization.

Class SDK 7 SDK 8 Status
BidderTokenLoader BidderTokenLoader(mediationNetworkName:) BidderTokenLoader() Changed
YandexAds MobileAds.initialize() YandexAds.setAdapterIdentity(_:) + YandexAds.initializeSDK() Changed
AdapterIdentity AdapterIdentity(adapterNetworkName:adapterVersion:adapterNetworkVersion:) Added

Examples

Swift
SDK 7 SDK 8
let tokenLoader = BidderTokenLoader(mediationNetworkName: "AdMob")
let config = BidderTokenRequestConfiguration(adType: .interstitial)
tokenLoader.loadBidderToken(requestConfiguration: config) { ... }

MobileAds.initialize()
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 SDK 8
YMABidderTokenLoader *tokenLoader =
    [[YMABidderTokenLoader alloc] initWithMediationNetworkName:@"AdMob"];
YMABidderTokenRequestConfiguration *config =
    [[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeInterstitial];
[tokenLoader loadBidderTokenWithRequestConfiguration:config
                                   completionHandler:^(NSString *token) { ... }];

[YMAMobileAds initialize];
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];

2. Changes to BidderTokenRequest

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

Class SDK 7 SDK 8 Status
BidderTokenRequestConfiguration BidderTokenRequest Renamed
BidderTokenRequestConfiguration init(adType: .banner) + .bannerAdSize BidderTokenRequest.banner(size:targeting:parameters:) Changed
BidderTokenRequestConfiguration init(adType: .interstitial) + .targetInfo BidderTokenRequest.interstitial(targeting:parameters:) Changed
BidderTokenRequestConfiguration init(adType: .rewarded) + .targetInfo BidderTokenRequest.rewarded(targeting:parameters:) Changed
BidderTokenRequestConfiguration init(adType: .native) + .targetInfo BidderTokenRequest.native(targeting:parameters:) Changed
BidderTokenRequestConfiguration init(adType: .appOpenAd) + .targetInfo BidderTokenRequest.appOpenAd(targeting:parameters:) Changed
BidderTokenLoader loadBidderToken(requestConfiguration:completionHandler:) loadBidderToken(request:completionHandler:) Renamed

Applies to: Mediation adapters using BidderTokenLoader.

Examples

Swift
SDK 7 SDK 8
let config = BidderTokenRequestConfiguration(adType: .banner)
config.bannerAdSize = adSize
config.targetInfo = adTargetInfo
tokenLoader.loadBidderToken(requestConfiguration: config) { ... }
let targeting = AdTargeting()
let request = BidderTokenRequest.banner(
    size: adSize,
    targeting: targeting,
    parameters: ["key": "value"]
)
tokenLoader.loadBidderToken(request: request) { ... }

// Other ad types:
let interstitialRequest = BidderTokenRequest.interstitial()
let rewardedRequest = BidderTokenRequest.rewarded()
let nativeRequest = BidderTokenRequest.native()
let appOpenRequest = BidderTokenRequest.appOpenAd()
Objective-C
SDK 7 SDK 8
YMABidderTokenRequestConfiguration *config =
    [[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeBanner];
config.bannerAdSize = adSize;
config.targetInfo = adTargetInfo;
[tokenLoader loadBidderTokenWithRequestConfiguration:config
                                   completionHandler:^(NSString *token) { ... }];
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 types:
YMABidderTokenRequest *interstitialRequest = [YMABidderTokenRequest interstitial];
YMABidderTokenRequest *rewardedRequest = [YMABidderTokenRequest rewarded];
YMABidderTokenRequest *nativeRequest = [YMABidderTokenRequest native];
YMABidderTokenRequest *appOpenRequest = [YMABidderTokenRequest appOpenAd];

SwiftUI integration

SwiftUI integration is now supported. See the SwiftUI section at the end of the iOS documentation menu:


AI-assisted migration (beta)

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

How to use

  1. Download the skill

The migration skill is available at GitHub Yandex Ads SDK iOS.

  • For Claude Desktop

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

cp -r Skills/migrate-yandex-ads-sdk-from-7-to-8 .claude/skills/
  • For Cursor IDE

copy the skill folder to your project and use a link to the SKILL.md file via @, for example:

@migrate-yandex-ads-sdk-from-7-to-8/SKILL.md
  • Alternative method: copy the contents of SKILL.md and all related files into a dialog with the AI assistant (however, this may exceed message limits).
  1. Use the prompt

After loading the skill, use the following prompt in the dialog with the AI assistant:

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

Warning

Always carefully review changes generated by AI.

While skills help AI assistants perform tasks correctly, you must personally review and verify all changes made by the agent. AI assistants can make mistakes, so manual code review is necessary.


Requirements

  • Xcode: 26.0 and above
  • AppMetricaCore: 6.0.0 and above
  • AppMetricaLibraryAdapter: 6.0.0 and above
  • AppMetricaAdSupport: 6.0.0 and above
  • AppMetricaIDSync: 6.0.0 and above