Migration guide
This page will walk through the migration process from a SDK version to another, starting from the version 7.0.0.
We advise your to update your SDK version regulary to avoid having to much work to do during migration and to have access to new features and bug fixes.
Migration from 7.17.1 to 7.17.2
Location detection default setting
The automatic location detection (provided that the application already got it, with adequate permissions)
is not done by default anymore in the Smart Display SDK, for data privacy and consent reasons.
The application is now responsible for getting the User consent to use his location for advertising purpose, and
in this condition only, activate the automatic location retrieval in the Smart Display SDK.
See the release checklist page for more information.
Migration from 7.12 to 7.14.0
Live Preview
The Live Preview feature has been removed from the Smart Display SDK.
If you were still using this feature, you must remove any call to the handleLivePreviewURL()
method (in the SASConfiguration
class) method from your code.
You can also remove any Smart Display SDK URL schemes defined in your project settings.
Visibility Percentage methods
All methods allowing to override the actual visibility of an ad have been removed from the Smart Display SDK.
If you were still using those methods, you must remove any call and implementation of visibilityPercentageForBannerView:
method of the SASBannerViewDelegate
protocol.
Migration from 7.4 to 7.6.0
Base URL
The configure(siteId:baseUrl:)
method is deprecated because the SDK can now automatically fetch the appropriate base URL (from the site ID parameter).
For most applications, you should use the configure(siteId:)
method instead.
configure(siteId:baseUrl:)
method, the SDK will ignore the baseURL parameter!If you really need to override the automatic base URL, you can use the
manualBaseURL
property of the SASConfiguration
shared instance.
Migration guide to version 7.0.0
Installation
With CocoaPods
The pod name has changed: it is now named Smart-Display-SDK
. If your were already using Cocoapods, don't forget to change the pod name in your Podfile.
pod 'Smart-Display-SDK', '~> 7.0.0'
Follow the Installation with Cocoapods guide for more info.
Without CocoaPods
Starting with version 7.0.0, the Smart Display SDK is distributed as an iOS Framework and not as a static library (*.a) anymore.
Manual installation is not recommended, please follow the Installation with Cocoapods guide.
Import
Version 6.10
// Previously all the headers were imported by the YourApp-Bridging-Header.h
#import "SASAd.h"
#import "SASAdView.h"
#import "SASBannerView.h"
#import "SASInterstitialView.h"
...
// Previously headers were imported one by one depending on your viewcontroller needs
#import "SASBannerView.h"
#import "SASInterstitialView.h"
...
Version 7.0
import SASDisplayKit
#import <SASDisplayKit/SASDisplayKit.h>
Configuration
In your AppDelegate
Version 6.10
//The site ID and the base URL must be set before using the SDK, otherwise no ad will be retrieved.
SASAdView.setSiteID(Constants.siteID(), baseURL: Constants.baseURL())
//The site ID and the base URL must be set before using the SDK, otherwise no ad will be retrieved.
[SASAdView setSiteID:kSiteID baseURL:kBaseURL];
Version 7.0
You need to use the new SASConfiguration
shared instance, to set your base URL and site ID.
// The site ID and the base URL must be set before using the SDK, otherwise no ad will be retrieved.
SASConfiguration.shared.configure(siteId: Constants.siteID, baseURL: Constants.baseURL)
// The site ID and the base URL must be set before using the SDK, otherwise no ad will be retrieved.
[[SASConfiguration sharedInstance] configureWithSiteId:kSiteID baseURL:kBaseURL];
Banner integration
How to load a Banner ad
Version 6.10
// Load an ad - REMOVED
banner.loadFormatId(Constants.bannerFormatID, pageId: Constants.bannerPageID, master: true, target: nil)
// Load an ad - REMOVED
[self.banner loadFormatId:kBannerFormatID pageId:kBannerPageID master:YES target:nil];
Version 7.0
You need to instantiate SASAdPlacement
to use the new method load(with:)
on a SASBannerView
instance
// Create a placement - NEW
let adPlacement = SASAdPlacement(siteId: Constants.siteID, pageId: Constants.bannerPageID, formatId: Constants.bannerFormatID)
// Load an ad on this placement - NEW
banner.load(with: adPlacement)
// Create a placement - NEW
SASAdPlacement *adPlacement = [SASAdPlacement adPlacementWithSiteId:kBannerSiteID pageId:kBannerPageID formatId:kBannerFormatID];
// Load an ad on this placement - NEW
[self.banner loadWithPlacement:adPlacement];
New delegate protocol
Version 6.10
Your delegate previously adopted the SASAdViewDelegate
protocol.
func adViewDidLoad(_ adView: SASAdView) {
NSLog("Banner has been loaded")
}
func adView(_ adView: SASAdView, didFailToLoadWithError error: Error) {
NSLog("Banner has failed to load with error: \(error.localizedDescription)")
}
- (void)adViewDidLoad:(SASAdView *)adView {
NSLog(@"Banner has been loaded");
}
- (void)adView:(SASAdView *)adView didFailToLoadWithError:(NSError *)error {
NSLog(@"Banner has failed to load with error: %@", [error description]);
}
Version 7.0
Your delegate needs to adopt the new SASBannerViewDelegate
protocol.
func bannerViewDidLoad(_ bannerView: SASBannerView) {
NSLog("Banner has been loaded")
}
func bannerView(_ bannerView: SASBannerView, didFailToLoadWithError error: Error) {
NSLog("Banner has failed to load with error: \(error.localizedDescription)")
}
- (void)bannerViewDidLoad:(SASBannerView *)bannerView {
NSLog(@"Banner has been loaded");
}
- (void)bannerView:(SASBannerView *)bannerView didFailToLoadWithError:(NSError *)error {
NSLog(@"Banner has failed to load with error: %@", [error localizedDescription]);
}
Interstitial integration
How to init and load an Interstitial ad
Version 6.10
Load and Show actions were sequential for the Interstitial and you got access to the view of the Interstitial.
// Init Interstitial view - REMOVED
self.interstitial = SASInterstitialView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height), loader: .activityIndicatorStyleBlack)
self.interstitial.delegate = self
self.interstitial.modalParentViewController = self
// Load an ad - REMOVED
self.interstitial.loadFormatId(Constants.interstitialFormatID, pageId: Constants.interstitialPageID, master: true, target: nil)
// Ad Interstitial view on top of current Navigation Controller view - REMOVED
self.navigationController?.view.addSubview(self.interstitial)
// Init Interstitial view - REMOVED
self.interstitial = [[SASInterstitialView alloc] initWithFrame:self.navigationController.view.bounds loader:SASLoaderActivityIndicatorStyleBlack];
self.interstitial.delegate = self;
self.interstitial.modalParentViewController = self;
// Load an ad - REMOVED
[self.interstitial loadFormatId:kInterstitialFormatID pageId:@"kInterstitialPageID" master:YES target:nil];
// Ad Interstitial view on top of current Navigation Controller view - REMOVED
[self.navigationController.view addSubview:self.interstitial];
Version 7.0
Load and Show actions are now totally asynchronous for Interstitial. This means that you can perform an ad call without showing the ad immediately.
Also, you cannot access the view of the Interstitial anymore.
You need to instantiate a SASAdPlacement
before creating a new SASInterstitialManager
instance.
// Create a placement - NEW
let adPlacement = SASAdPlacement(siteId: Constants.siteID, pageId: Constants.interstitialPageID, formatId: Constants.interstitialFormatID)
// Init Interstitial Manager with this placement - NEW
self.interstitialManager = SASInterstitialManager(placement: adPlacement, delegate: self)
// Load an ad - NEW
self.interstitialManager.load()
// Create a placement - NEW
SASAdPlacement *placement = [SASAdPlacement adPlacementWithSiteId:kInterstitialSiteID pageId:kInterstitialPageID formatId:kInterstitialFormatID];
// Init Interstitial Manager with this placement - NEW
self.interstitialManager = [[SASInterstitialManager alloc] initWithPlacement:placement delegate:self];
// Load an ad - NEW
[self.interstitialManager load];
To show the Interstitial, wait for it to be ready and call the new show(from:)
method:
To know if an Interstitial is ready to show, you can rely on the new property adStatus
value.
// Show the ad - NEW
if self.interstitialManager.adStatus == SASAdStatusReady {
self.interstitialManager.show(from: self)
}
// Show the ad - NEW
if (self.interstitialManager.adStatus == SASAdStatusReady) {
[self.interstitialManager showFromViewController:self];
}
New delegate protocol
Version 6.10
Your delegate adopted the SASAdViewDelegate
protocol.
func adViewDidLoad(_ adView: SASAdView) {
NSLog("Interstitial has been loaded")
}
func adView(_ adView: SASAdView, didFailToLoadWithError error: Error) {
NSLog("Interstitial has failed to load with error: \(error.localizedDescription)")
}
- (void)adViewDidLoad:(SASAdView *)adView {
NSLog(@"Interstitial has been loaded");
}
- (void)adView:(SASAdView *)adView didFailToLoadWithError:(NSError *)error {
NSLog(@"Interstitial has failed to load with error: %@", [error description]);
}
Version 7.0
Your delegate needs to adopt the SASInterstitialManagerDelegate
protocol.
Note: you are now notified if an error occured during the load or the show phase.
func interstitialManager(_ manager: SASInterstitialManager, didLoad ad: SASAd) {
NSLog("Interstitial has been loaded")
}
func interstitialManager(_ manager: SASInterstitialManager, didFailToLoadWithError error: Error?) {
NSLog("Interstitial has failed to load with error: \(error!.localizedDescription)")
}
func interstitialManager(_ manager: SASInterstitialManager, didFailToShowWithError error: Error?) {
NSLog("Interstitial has failed to show with error: \(error!.localizedDescription))")
}
- (void)interstitialManager:(SASInterstitialManager *)manager didLoadAd:(SASAd *)ad {
// Interstitial is ready to be shown
NSLog(@"Interstitial has been loaded and is ready to be shown");
}
- (void)interstitialManager:(SASInterstitialManager *)manager didFailToLoadWithError:(NSError *)error {
// Interstitial failed to load
NSLog(@"Interstitial did fail to load with error: %@", [error localizedDescription]);
}
- (void)interstitialManager:(SASInterstitialManager *)manager didFailToShowWithError:(NSError *)error {
// Interstitial failed to show after being successfully loaded
// This kind of error only occurs if a showFromViewController is performed on your SASInterstitialManager instance
NSLog(@"Interstitial did fail to show with error: %@", [error localizedDescription]);
}
Rewarded Video integration
How to init and load a Rewarded Video ad
Version 6.10
// Set the current controller as Rewarded Video Delegate - REMOVED
SASRewardedVideo.setDelegate(self)
// Create a rewarded video placement - REMOVED
self.placement = SASRewardedVideoPlacement.init(pageId: pageId, formatId: formatId, target: target)
// Load an Ad on this placement - REMOVED
SASRewardedVideo.loadAd(for: self.placement!)
// Set the current controller as Rewarded Video Delegate - REMOVED
[SASRewardedVideo setDelegate:self];
// Create a rewarded video placement - REMOVED
self.placement = [SASRewardedVideoPlacement rewardedVideoPlacementWithPageId:kRewardedPageID
formatId:kRewardedFormatID
target:kRewardedTarget];
// Load an Ad on this placement - REMOVED
[SASRewardedVideo loadAdForPlacement:self.placement];
To show the Rewarded Video ad, when it was ready, you were calling showAd:
method.
// Check that the ad is ready for our placement
if (SASRewardedVideo.isAdReady(for: self.placement!)) {
// If the ad is ready, show it.
SASRewardedVideo.showAd(for: self.placement!, from:self.navigationController!)
}
// Check that the ad is ready for our placement
if ([SASRewardedVideo isAdReadyForPlacement:self.placement]) {
// If the ad is ready, show it.
[SASRewardedVideo showAdForPlacement:self.placement fromViewController:self.navigationController];
}
Version 7.0
SASRewardedVideo
shared instance has been replaced by SASRewardedVideoManager
instances.
You need to use a SASAdPlacement
instance to initialize a SASRewardedVideoManager
.
// Create a placement - NEW
let placement = SASAdPlacement(siteId: Constants.siteID, pageId: Constants.rewardedVideoPageID, formatId: Constants.rewardedVideoFormatID)
// Init Rewarded Video Manager on this placement - NEW
self.rewardedVideoManager = SASRewardedVideoManager(placement: adPlacement, delegate: self)
// Load an ad - NEW
self.rewardedVideoManager.load()
// Create a placement - NEW
SASAdPlacement *placement = [SASAdPlacement adPlacementWithSiteId:kRewardedVideoSiteID
pageId:kRewardedVideoPageID
formatId:kRewardedVideoFormatID];
// Init Rewarded Video Manager on this placement - NEW
self.rewardedVideoManager = [[SASRewardedVideoManager alloc] initWithPlacement:placement delegate:self];
// Load an ad - NEW
[self.rewardedVideoManager load];
To show the Rewarded Video ad, when it's ready, just call the new show:
method.
To know if a Rewarded Video is ready to show, you can rely on the property adStatus
value.
// Check if a rewarded video ad is ready - NEW
if self.rewardedVideoManager.adStatus == SASAdStatusReady {
self.rewardedVideoManager.show(from: self)
}
// Check if a rewarded video ad is ready - NEW
if (self.rewardedVideoManager.adStatus == SASAdStatusReady) {
// Show the ad - NEW
[self.rewardedVideoManager showFromViewController:self];
}
New delegate protocol
Version 6.10
Your delegate previously adopted the SASRewardedVideoDelegate
protocol.
func rewardedVideoDidLoad(_ ad: SASAd, for placement: SASRewardedVideoPlacement) {
NSLog("RewardedVideo did load")
}
func rewardedVideoDidFailToLoad(for placement: SASRewardedVideoPlacement, error: Error?) {
NSLog("RewardedVideo did fail to load with error \(String(describing: error?.localizedDescription))")
}
func rewardedVideoDidFailToShow(for placement: SASRewardedVideoPlacement, error: Error?) {
NSLog("RewardedVideo did fail to show with error \(String(describing: error?.localizedDescription))")
}
- (void)rewardedVideoDidLoadAd:(SASAd *)ad forPlacement:(SASRewardedVideoPlacement *)placement {
NSLog(@"RewardedVideo did load");
}
- (void)rewardedVideoDidFailToLoadForPlacement:(SASRewardedVideoPlacement *)placement error:(nullable NSError *)error {
NSLog(@"RewardedVideo did fail to load with error: %@", [error localizedDescription]);
}
- (void)rewardedVideoDidFailToShowForPlacement:(SASRewardedVideoPlacement *)placement error:(nullable NSError *)error {
NSLog(@"RewardedVideo did fail to show with error: %@", [error localizedDescription]);
}
Version 7.0
Your delegate needs to adopt the SASRewardedVideoManagerDelegate
protocol.
func rewardedVideoManager(_ manager: SASRewardedVideoManager, didLoad ad: SASAd) {
NSLog("RewardedVideo has been loaded and is ready to be shown");
}
func rewardedVideoManager(_ manager: SASRewardedVideoManager, didFailToLoadWithError error: Error?) {
NSLog("RewardedVideo did fail to load with error \(String(describing: error?.localizedDescription))")
}
func rewardedVideoManager(_ manager: SASRewardedVideoManager, didFailToShowWithError error: Error?) {
NSLog("RewardedVideo did fail to show with error \(String(describing: error?.localizedDescription))")
}
- (void)rewardedVideoManager:(SASRewardedVideoManager *)manager didLoadAd:(SASAd *)ad {
NSLog(@"RewardedVideo has been loaded and is ready to be shown");
}
- (void)rewardedVideoManager:(SASRewardedVideoManager *)manager didFailToLoadWithError:(NSError *)error {
NSLog(@"RewardedVideo did fail to load with error: %@", [error localizedDescription]);
}
- (void)rewardedVideoManager:(SASRewardedVideoManager *)manager didFailToShowWithError:(NSError *)error {
NSLog(@"RewardedVideo did fail to show with error: %@", [error localizedDescription]);
}
Native Ad integration
Replacement of Native Ad Placement class
Version 6.10
The SASNativeAdManager
instances were initialized with a SASNativeAdPlacement
.
Version 7.0
You need to use a SASAdPlacement
to initialize your SASNativeAdManager
.