Getting started
Requirements:
- Xcode 15.3 or higher.
- iOS 12.0 or higher.
Add XMediator to your iOS Project
Cocoapods
We recommend using Cocoapods to integrate the SDK. Open your Podfile and add this line at the beginning:
You will also need to add the following line inside your app's target:
Finally, run from the command line:
Add mediation adapters
To integrate additional mediation network adapters, add the corresponding lines to your project's Podfile.
For instance, here is how to add the Google Ads mediation adapter for XMediator:
Some networks may have further integration instructions. You can find these in each adapter's changelog page.
For a complete list of supported ad partners please refer to Supported ad networks.
Choose networks
Pick networks to generate a code snippet for your Podfile:
Initialize the SDK
Before requesting any ad, make sure to call XMediatorAds.startWith()
. This method configures your application Key, and fetches the required configuration parameters for the ad placements in your app, among other things.
Additionally, you may want to wait for the initialization callback to complete. This will ensure that your placement' requests have the necessary prebid configurations.
import XMediator
let userProperties = UserProperties(userId: "<an-optional-unique-user-id>")
let initSettings = InitSettings(userProperties: userProperties)
XMediatorAds.startWith(appKey: "<your-app-key>",
initSettings: initSettings) { result in
print("Initialization complete! You can start loading your placements!")
}
@import XMediatorObjC;
X3MUserProperties *userProperties = [X3MUserProperties new];
userProperties.userId = @"<an-optional-unique-user-id>";
X3MInitSettings *initSettings = [X3MInitSettings new];
initSettings.userProperties = userProperties;
[X3MXMediatorAds startWithAppKey:@"<your-app-key>"
initSettings:initSettings
callback:^(NSError * _Nullable error) {
NSLog(@"Initialization complete! You can start loading your placements!");
}];
You may also configure additional options by passing in an InitSettings
instance to the initialize method.
For a complete list of available options please see InitSettings Class.
Warning
To ensure the SDK is correctly configured before ad mediation begins, any method that performs an ad request will raise an exception if they are called before XMediatorAds.startWith()
is invoked.
It is mandatory to wait for the init callback to complete before making any ad request.