Guide to migrating to version 6
Warning
Be sure to update to the latest adapter versions (Yandex Mediation and adapters for third-party mediation networks). Otherwise, errors from improper adapter integration might occur, preventing the ad 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 your ad type:
Use the stickySizeWithContainerWidth:(CGFloat)width method to create an adaptive sticky banner.
An adaptive sticky banner is a small, automatically updated ad placed at the bottom or top of the app screen.
The banner doesn't overlap the main app content and is often used in gaming apps.
The height of the sticky banner is determined automatically, adapting to the device screen size and not exceeding 15% of the screen height.
Warning
Starting with version 6.0.0, adaptive sticky banners can refresh automatically.
If you previously implemented auto-refresh for a sticky-banner, you should now disable it.
Use the inlineSizeWithWidth:(CGFloat)width maxHeight:(CGFloat)height method to create an adaptive inline banner.
An adaptive inline banner is a flexible banner ad format that ensures maximum efficiency by optimizing ad size for each device.
The banner height is selected automatically and can reach the height of the device screen.
Typically, this format is used in feed-based apps or contexts where it's acceptable to primarily focus user attention on ads.
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. 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 |
SDK 5
SDK 6
|
|
Removed the deprecated method |
SDK 5
SDK 6 Use the
Alternatively, you can use the
|
|
Renamed the |
SDK 5
SDK 6
|
|
Renamed the |
SDK 5
SDK 6
|
Rewarded ads
The approach to creating and loading advertisements has been revised. 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 ads
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 for loading and rendering ads 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 ads
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
Be sure to update to the latest adapter versions (Yandex Mediation and adapters for third-party mediation networks). Otherwise, errors from improper adapter integration might occur, preventing the ad 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: 10.9.0.
- Unity LevelPlay: 7.4.0.
Renaming the Google 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
|
SDK 6
|