Meson supports both Cocoapods and manual download mechanisms to integrate our SDK.
CocoaPods is a dependency manager for Objective-C and Swift; it automates and simplifies the SDK integration process. See the CocoaPods Guide on Getting Started and Using CocoaPods for more information.
To integrate the Meson SDK with CocoaPods, enter the following in your podfile:
pod 'MesonWrapSDK', '2.0.0'
After download, unzip it and add MesonWrapSDK.xcframework into your Xcode Project.
To add GAM plugins with Cocoapods, enter the following in your podfile:
pod 'MesonWrapGAM', '2.0.0'
After download, unzip it and add MesonWrapGAM.xcframework into your Xcode Project.
If your project is in Objective C:
To ensure uninterrupted support for ad delivery across all SDK-less Networks / Demand Partners, it's important to make the following changes in your info.plist:
Make sure that your info.plist does not contain any other exceptions besides 'NSAllowsArbitraryLoad', as this might create a conflict. Find more information on ATS here.
Initialize the SDK as follows:
//Import the MesonWrapSDK
import MesonWrapSDK
let completionBlock: ((Error?) -> Void)? = { error in
if let error = error as Error? {
print(error.localizedDescription)
return
} else {
print("MesonWrap SDK initialised successfully")
}
}
let gdprConsentDictionary : [String: Any] = ["gdpr": "0", "gdpr_consent" : "<IABString>"]
MesonWrap.initialize(appId: "<#AppId>", gdpr: gdprConsentDictionary, completion: completionBlock)
//Import the MesonWrapSDK;
@import MesonWrapSDK;
void (^completionBlock)(NSError*) = ^( NSError* _Nullable error) {
if (error) {
NSLog(@"%@", error.description);
}
else {
NSLog(@"MesonWrap SDK initialised successfully");
}
};
NSDictionary *gdprConsentDictionary = @{@"gdpr": @"0", @"gdpr_consent" : @"<IABString>"};
[MesonWrap initSDKWithAppId:@"<#AppId>" gdpr: gdprConsentDictionary completion:completionBlock];
To help publishers comply with the California Consumer Privacy Act (CCPA), the Meson SDK allows publishers to use either of the following parameters to enable restricted data processing (RDP). The parameter can be set at an ad request level utilizing the following parameters:
rdp: Set this to 1 for signaling restricted data processing.
us_privacy: Follow the IAB specification for signaling restricted data processing.
// You can notify Meson that restricted data processing is enabled using either of the following parameters.
let extras = [
"rdp": false,
"iab_usprivacy_string": "1YNN"
] as [String : Any]
Meson.setExtras(extras)
// You can notify Meson that restricted data processing is enabled using either of the following parameters.
NSDictionary *extras = @{
@"rdp": @(FALSE),
@"iab_usprivacy_string": @("1YNN"),
};
[Meson setExtras:extras];
This is optional. In case you want to send us any information about the user, please do as follows:
To set user data, follow:
//Set Extras
let extras = [
"age": age,
"gender": Gender.Male.rawValue,
"interests":"<interests>",
"language": "<language>",
"customIds": [ ["idtype":"PPID", "value": "adada134412y1876dad"],
["idtype":"IDL", "value": "mpqdan134412y1876dad"]],
"segments": ["s1","s2","s3"],
"experiments": ["e1","e2","e3"]] as [String : Any]
Meson.setExtras(extras)
//Set Location
Meson.setLocation(<CLLocation>)
NSDictionary *extras = @{
@"age": @(18),
@"gender": @(GenderMale),
@"interests":@"<interests>",
@"language": @"<language>",
@"customIds": @[ @{@"idtype":@"IMEI", @"value": @"adada134412y1876dad"},
@{@"idtype":@"CAID", @"value": @"mpqdan134412y1876dad"}],
@"segments": @[@"s1",@"s2",@"s3"],
@"experiments": @[@"e1",@"e2",@"e3"]};
[Meson setExtras:extras];
//Set Location
[Meson setLocation:<#CLLocation>];
To get or reset user data, follow:
//Getters
Meson.getExtras() //gets the extra values set in SetExtras
Meson.getSDKVersion() //gets the SDK version
//Clears Extras, location
Meson.clearUserInfo()
//Getters
[Meson getSDKVersion];
[Meson getExtras];
//Clears extras, location
[Meson cleanUserInfo];
When logging is set to DEBUG, SDK will print key logs to the console that provide useful information about the initialization and bid request lifecycle.
MesonWrap.setLogLevel(level: .debug)
[MesonWrap setLogLevelWithLevel:LogLevelDebug];
Next, let's integrate Banner/Interstitial ad units.