Migration guide 1.9 -> 2.x
You can get acquainted with the main changes in version 2.0 in the manual
Cocoapods
Removed mandatory dependency on IAB adapter. Now it is enough just to register BidMachine dependencies
1.9
platform :ios, '10.0'
workspace 'YourApp.xcworkspace'
target 'YourTarget' do
project 'YourProject/YourTarget.xcodeproj'
pod "BidMachine", "~> 1.9.5.0"
pod "BDMIABAdapter", "~> 1.9.5.0"
end
platform :ios, '10.0'
workspace 'YourApp.xcworkspace'
target 'YourTarget' do
project 'YourProject/YourTarget.xcodeproj'
pod "BidMachine", "~> 1.9.5.0"
pod "BDMIABAdapter", "~> 1.9.5.0"
pod "BDMAdColonyAdapter", "~> 1.9.5.0"
pod "BDMAmazonAdapter", "~> 1.9.5.0"
pod "BDMCriteoAdapter", "~> 1.9.5.0"
pod "BDMFacebookAdapter", "~> 1.9.5.0"
pod "BDMMyTargetAdapter", "~> 1.9.5.0"
pod "BDMSmaatoAdapter", "~> 1.9.5.0"
pod "BDMTapjoyAdapter", "~> 1.9.5.0"
pod "BDMVungleAdapter", "~> 1.9.5.0"
pod "BDMPangleAdapter", "~> 1.9.5.0"
pod "BDMNotsyAdapter", "~> 1.9.5.0"
end
2.0
platform :ios, '10.0'
source 'https://github.com/appodeal/CocoaPods.git'
source 'https://cdn.cocoapods.org/'
workspace 'YourApp.xcworkspace'
use_frameworks!
target 'YourTarget' do
project 'YourProject/YourTarget.xcodeproj'
pod "BidMachine", "~> 2.1.0.0"
end
platform :ios, '10.0'
source 'https://github.com/appodeal/CocoaPods.git'
source 'https://cdn.cocoapods.org/'
workspace 'YourApp.xcworkspace'
use_frameworks!
target 'YourTarget' do
project 'YourProject/YourTarget.xcodeproj'
pod "BidMachine", "~> 2.1.0.0"
pod "BidMachineAdColonyAdapter", "~> 2.1.0.0"
pod "BidMachineAmazonAdapter", "~> 2.1.0.0"
pod "BidMachineCriteoAdapter", "~> 2.1.0.0"
pod "BidMachineMetaAudienceAdapter", "~> 2.1.0.0"
pod "BidMachineMyTargetAdapter", "~> 2.1.0.0"
pod "BidMachineSmaatoAdapter", "~> 2.1.0.0"
pod "BidMachineTapjoyAdapter", "~> 2.1.0.0"
pod "BidMachineVungleAdapter", "~> 2.1.0.0"
pod "BidMachinePangleAdapter", "~> 2.1.0.0"
end
Initialization
The initialization system has been worked out. Now there is no callback about the end of initialization. All interactions with the SDK can be carried out immediately after calling the initialization method
1.9
let sellerID = "Your Seller ID"
BDMSdk.shared().startSession(withSellerID: sellerID, completion: nil)
[BDMSdk.sharedSdk startSessionWithSellerID:@"5"
completion:nil];
2.0
BidMachineSdk.shared.initializeSdk("YOUR_SOURCE_ID")
[BidMachineSdk.shared initializeSdk:@"YOUR_SOURCE_ID"];
Targeting
The system for recording values from KV to builder sync operation has been redesigned. Changed to prevent asynchronous reads and writes and prevent errors associated with them
1.9
let configuration = BDMSdkConfiguration()
let targeting = BDMTargeting()
configuration.targeting = targeting
BDMSdk.shared().startSession(withSellerID: sellerID, configuration: configuration, completion: {
})
BDMSdkConfiguration *config = [BDMSdkConfiguration new];
config.targeting = BDMTargeting.new;
config.targeting.storeId = @"12345";
config.testMode = YES;
[BDMSdk.sharedSdk startSessionWithSellerID:@"5"
configuration:config
completion:^{
}];
2.0
BidMachineSdk.shared.publisherInfo.populate {
$0.
}
BidMachineSdk.shared.targetingInfo.populate {
$0.
}
BidMachineSdk.shared.regulationInfo.populate {
$0.
}
[BidMachineSdk.shared.publisherInfo populate:^(id<BidMachinePublisherInfoBuilderProtocol> builder) {
}];
[BidMachineSdk.shared.targetingInfo populate:^(id<BidMachineTargetingInfoBuilderProtocol> builder) {
}];
[BidMachineSdk.shared.regulationInfo populate:^(id<BidMachineRegulationInfoBuilderProtocol> builder) {
}];
Token
1.9
BDMSdk.shared().biddingToken
[BDMSdk.shared biddingToken];
2.0
BidMachineSdk.shared.token
[BidMachineSdk.shared token];
Request
A system for creating a request has been developed. The request has become a more abstract class. And it carries only the function of transferring loading parameters
1.9
let request = BDMBannerRequest()
request.perform(with: self)
self.request = [BDMBannerRequest new];
self.request.adSize = BDMBannerAdSize320x50;
[self.request performWithDelegate:self];
2.0
let config = try? BidMachineSdk.shared.requestConfiguration(.banner)
config?.populate {
$0.
}
NSError *error = nil;
id<BidMachineRequestConfigurationProtocol> config = [BidMachineSdk.shared requestConfiguration:BidMachinePlacementFormatBanner error:&error];
[config populate:^(id<BidMachineRequestBuilderProtocol> builder) {
}];
Ad Object
Redesigned adObject. Now it is a more abstract class with a single interface for all types
1.9
private var banner: BDMBannerView?
private var request: BDMBannerRequest?
func load() {
let banner = BDMBannerView(frame: CGRect(origin: .zero, size: CGSizeFromBDMSize(.size320x50)))
let request = BDMBannerRequest()
banner.delegate = self
banner.populate(with: request)
self.banner = banner
self.request = request
}
func present() {
guard let banner = self.banner, banner.canShow else {
return
}
self.view.addSubview(banner)
}
@interface Banner ()
@property (nonatomic, strong) BDMBannerView *banner;
@property (nonatomic, strong) BDMBannerRequest *request;
@end
@implementation Banner
- (void)load {
self.request = [BDMBannerRequest new];
self.request.adSize = BDMBannerAdSize320x50;
self.banner = [BDMBannerView new];
self.banner.delegate = self;
[self.banner populate:self.request];
}
- (void)present {
[self.view addSubview: self.banner];
}
@end
2.0
let config = try? BidMachineSdk.shared.requestConfiguration(.banner)
BidMachineSdk.shared.ad(config) { [weak self] ad, error in
guard let self = self else {
return
}
self.ad.delegate = self
self.ad.controller = self
self.ad = ad
self.ad.loadAd()
}
id<BidMachineRequestConfigurationProtocol> config = [BidMachineSdk.shared requestConfiguration:BidMachinePlacementFormatBanner error:&error];
[BidMachineSdk.shared banner:config :^(BidMachineBanner * _Nullable banner, NSError * _Nullable error) {
banner.controller = self;
banner.delegate = self;
[banner loadAd];
self.banner = banner;
}];
Updated about 1 year ago