Guide for migrating to version 8
Yandex Mobile Ads SDK 8.0.0 introduces multiple API changes aimed at improving the developer experience.
For Objective-C projects, see Section 14 (MainActor) to ensure proper handling of MainActor-isolated classes. Perform operations with these classes on the main thread.
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
|
SDK 7
|
let configuration = AdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
loader.loadAd(with: configuration)
|
|
SDK 8
|
let request = AdRequest(adUnitID: "R-M-XXXXX-YY") loader.loadAd(with: request) { … }
|
|
SDK 7
|
YMAAdRequestConfiguration *configuration =
[[YMAAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
[loader loadAdWithConfiguration:configuration];
|
|
SDK 8
|
YMAAdRequest *request =
[[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
[loader loadAdWithRequest:request
completionHandler:^(YMAInterstitialAd * _Nullable ad,
NSError * _Nullable error) {
if (ad) {
} else {
}
}];
|
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.
The AdTargetInfo class has been renamed to AdTargeting, and the targetInfo field within AdRequestTokenConfiguration and BidderTokenRequestConfiguration has been renamed to targeting.
|
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
|
SDK 7
|
let request = AdRequest(
adUnitID: "R-M-XXXXX-YY",
age: 25,
gender: kYMAGenderMale,
location: location
)
|
|
SDK 8
|
let targeting = AdTargeting(
age: 25,
gender: .male,
location: location
)
let request = AdRequest(adUnitID: "R-M-XXXXX-YY", targeting: targeting)
|
|
SDK 7
|
YMAAdRequest *request = [[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
age:@(25)
gender:kYMAGenderMale
location:location];
|
|
SDK 8
|
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 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
|
SDK 7
|
let configuration = AdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
interstitialAdLoader.delegate = self
interstitialAdLoader.loadAd(with: configuration)
let nativeConfiguration = NativeAdRequestConfiguration(adUnitID: "R-M-XXXXX-YY")
nativeAdLoader.delegate = self
nativeAdLoader.loadAd(with: nativeConfiguration)
|
|
SDK 8
|
let request = AdRequest(adUnitID: "R-M-XXXXX-YY")
interstitialAdLoader.loadAd(with: request) { result in
switch result {
case .success(let ad):
case .failure(let error):
}
}
let options = NativeAdOptions()
nativeAdLoader.loadAd(with: request, options: options) { result in
switch result {
case .success(let ad):
case .failure(let error):
}
}
|
|
SDK 7
|
YMAAdRequestConfiguration *configuration =
[[YMAAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
interstitialAdLoader.delegate = self;
[interstitialAdLoader loadAdWithConfiguration:configuration];
YMANativeAdRequestConfiguration *nativeConfig =
[[YMANativeAdRequestConfiguration alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
nativeAdLoader.delegate = self;
[nativeAdLoader loadAdWithConfiguration:nativeConfig];
|
|
SDK 8
|
YMAAdRequest *request =
[[YMAAdRequest alloc] initWithAdUnitID:@"R-M-XXXXX-YY"];
[interstitialAdLoader loadAdWithRequest:request
completionHandler:^(YMAInterstitialAd * _Nullable ad,
NSError * _Nullable error) {
if (ad) {
} else {
}
}];
YMANativeAdOptions *options = [[YMANativeAdOptions alloc] init];
[nativeAdLoader loadAdWithRequest:request
options:options
completionHandler:^(id<YMANativeAd> _Nullable ad,
NSError * _Nullable error) {
if (ad) {
} else {
}
}];
|
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
let request = AdRequest(adUnitID: "R-M-XXXXX-YY")
let interstitialAd = try await interstitialAdLoader.loadAd(with: request)
let rewardedAd = try await rewardedAdLoader.loadAd(with: request)
let appOpenAd = try await appOpenAdLoader.loadAd(with: request)
let options = NativeAdOptions()
let nativeAd = try await nativeAdLoader.loadAd(with: request, options: options)
let sliderAd = try await sliderAdLoader.loadAd(with: request, options: options)
let nativeAds = try await nativeBulkAdLoader.loadAds(with: request, adsCount: 3, options: options)
Structured concurrency is supported only for Swift.
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
|
SDK 7
|
let adSize = BannerAdSize.stickySize(withContainerWidth: screenWidth)
let adView = AdView(adUnitID: "R-M-XXXXX-YY", adSize: adSize)
adView.delegate = self
adView.loadAd()
|
|
SDK 8
|
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)
|
|
SDK 7
|
YMABannerAdSize *adSize = [YMABannerAdSize stickySizeWithContainerWidth:screenWidth];
YMAAdView *adView = [[YMAAdView alloc] initWithAdUnitID:@"R-M-XXXXX-YY"
adSize:adSize];
adView.delegate = self;
[adView loadAd];
|
|
SDK 8
|
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
- 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,
NativeAd,
SliderAd,
AppOpenAd,
InterstitialAd,
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
|
SDK 7
|
let attributes = nativeAd.adAttributes
let info = nativeAd.info
let creativeID = interstitialAd.creativeID
let campaignID = interstitialAd.campaignID
let adUnitId = interstitialAd.adInfo.adUnitId
let size = bannerAdView.adInfo.adSize
|
|
SDK 8
|
let creatives = nativeAd.adInfo.creatives
let extraData = nativeAd.adInfo.extraData
if let creative = interstitialAd.adInfo.creatives.first {
let creativeID = creative.creativeID
let campaignID = creative.campaignID
let placeID = creative.placeID
let offerID = creative.offerID
}
let adUnitID = interstitialAd.adInfo.adUnitID
let partnerText = interstitialAd.adInfo.partnerText
|
|
SDK 7
|
NSArray *attributes = nativeAd.adAttributes;
NSDictionary *info = nativeAd.info;
NSString *creativeID = interstitialAd.creativeID;
NSString *campaignID = interstitialAd.campaignID;
NSString *adUnitId = interstitialAd.adInfo.adUnitId;
YMAAdSize *size = bannerAdView.adInfo.adSize;
|
|
SDK 8
|
NSArray<YMACreative *> *creatives = nativeAd.adInfo.creatives;
NSDictionary *extraData = nativeAd.adInfo.extraData;
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;
}
NSString *adUnitID = interstitialAd.adInfo.adUnitID;
NSString *partnerText = interstitialAd.adInfo.partnerText;
|
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
|
SDK 7
|
import YandexMobileAds
MobileAds.setLocationTrackingEnabled(true)
MobileAds.setAgeRestrictedUser(false)
MobileAds.setUserConsent(true)
let version = MobileAds.sdkVersion
|
|
SDK 8
|
import YandexMobileAds
YandexAds.setLocationTracking(true)
YandexAds.setAgeRestricted(false)
YandexAds.setUserConsent(true)
let version = YandexAds.sdkVersion.stringValue
|
|
SDK 7
|
[YMAMobileAds setLocationTrackingEnabled:YES];
[YMAMobileAds setAgeRestrictedUser:NO];
[YMAMobileAds setUserConsent:YES];
NSString *version = YMAMobileAds.sdkVersion;
|
|
SDK 8
|
[YMAYandexAds setLocationTracking:YES];
[YMAYandexAds setAgeRestricted:NO];
[YMAYandexAds setUserConsent:YES];
NSString *version = YMAYandexAds.sdkVersion.stringValue;
|
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
|
SDK 7
|
let warningText: String? = nativeAd.adAssets.warning
label.text = warningText
|
|
SDK 8
|
let warning: NativeAdWarning? = nativeAd.adAssets.warning
label.text = warning?.value
|
|
SDK 7
|
NSString *warningText = nativeAd.adAssets.warning;
label.text = warningText;
|
|
SDK 8
|
YMANativeAdWarning *warning = nativeAd.adAssets.warning;
label.text = warning.value;
|
NativeAdMedia now includes a new property: hasVideo.
|
Class
|
Property
|
Status
|
|
NativeAdMedia
|
hasVideo: Bool
|
Added
|
Examples
if let media = nativeAd.adAssets.media, media.hasVideo {
}
if (nativeAd.adAssets.media != nil && nativeAd.adAssets.media.hasVideo) {
}
$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
|
SDK 7
|
nativeAd.addImageLoadingObserver(self)
nativeAd.loadImages()
sliderAd.addImageLoadingObserver(self)
sliderAd.loadImages()
|
|
SDK 8
|
nativeAd.loadImages { [weak self] in
}
await nativeAd.loadImages()
sliderAd.loadImages { [weak self] in
}
await sliderAd.loadImages()
|
|
SDK 7
|
[nativeAd addImageLoadingObserver:self];
[nativeAd loadImages];
[sliderAd addImageLoadingObserver:self];
[sliderAd loadImages];
|
|
SDK 8
|
[nativeAd loadImagesWithCompletionHandler:^{
}];
[sliderAd loadImagesWithCompletionHandler:^{
}];
|
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
- 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
|
SDK 7
|
rating.setRating(4.5)
let value = rating.rating()
let audioManager = MobileAds.audioSessionManager()
|
|
SDK 8
|
rating.rating = 4.5
let audioManager = YandexAds.audioSessionManager
|
|
SDK 7
|
[rating setRating:4.5];
CGFloat value = [rating rating];
YMAAudioSessionManager *audioManager = [YMAMobileAds audioSessionManager];
|
|
SDK 8
|
rating.rating = 4.5;
YMAAudioSessionManager *audioManager = YMAYandexAds.audioSessionManager;
|
- 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
|
SDK 7
|
let tokenLoader = BidderTokenLoader(mediationNetworkName: "AdMob")
let config = BidderTokenRequestConfiguration(adType: .interstitial)
tokenLoader.loadBidderToken(requestConfiguration: config) { ... }
MobileAds.initialize()
|
|
SDK 8
|
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()
|
|
SDK 7
|
YMABidderTokenLoader *tokenLoader =
[[YMABidderTokenLoader alloc] initWithMediationNetworkName:@"AdMob"];
YMABidderTokenRequestConfiguration *config =
[[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeInterstitial];
[tokenLoader loadBidderTokenWithRequestConfiguration:config
completionHandler:^(NSString *token) { ... }];
[YMAMobileAds initialize];
|
|
SDK 8
|
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, 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
|
SDK 7
|
let config = BidderTokenRequestConfiguration(adType: .banner)
config.bannerAdSize = adSize
config.targetInfo = adTargetInfo
tokenLoader.loadBidderToken(requestConfiguration: config) { ... }
|
|
SDK 8
|
let targeting = AdTargeting()
let request = BidderTokenRequest.banner(
size: adSize,
targeting: targeting,
parameters: ["key": "value"]
)
tokenLoader.loadBidderToken(request: request) { ... }
let interstitialRequest = BidderTokenRequest.interstitial()
let rewardedRequest = BidderTokenRequest.rewarded()
let nativeRequest = BidderTokenRequest.native()
let appOpenRequest = BidderTokenRequest.appOpenAd()
|
|
SDK 7
|
YMABidderTokenRequestConfiguration *config =
[[YMABidderTokenRequestConfiguration alloc] initWithAdType:YMAAdTypeBanner];
config.bannerAdSize = adSize;
config.targetInfo = adTargetInfo;
[tokenLoader loadBidderTokenWithRequestConfiguration:config
completionHandler:^(NSString *token) { ... }];
|
|
SDK 8
|
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) { ... }];
YMABidderTokenRequest *interstitialRequest = [YMABidderTokenRequest interstitial];
YMABidderTokenRequest *rewardedRequest = [YMABidderTokenRequest rewarded];
YMABidderTokenRequest *nativeRequest = [YMABidderTokenRequest native];
YMABidderTokenRequest *appOpenRequest = [YMABidderTokenRequest appOpenAd];
|
SwiftUI integration
The API now supports SwiftUI integration. See the SwiftUI section at the end of the iOS documentation menu:
AI-assisted migration (beta)
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
- Download the skill
The migration skill is available at GitHub Yandex Ads SDK iOS.
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/
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.
- 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
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.
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.
Requirements
- Xcode: 26.0 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