Skip to content

Test your integration

Request Test Ads

When testing you should request ads by setting the test flag to true when initializing XMediator. We use this flag to ask the underlying networks to provide us with test ads when possible.

Info

Some networks may not support this flag and might provide other means to test their integration so make sure to always check the ad network's documentation for any additional steps.

We do provide test Placement Ids to enable a quick way to test the integration.

Test Placement Ids
Placement Value
App key 3-15
Banner 3-15/28
Interstitial 3-15/26
Rewarded 3-15/27

Currently, these placements are only supported for Google Ads, AppLovin, Chartboost, Unity Ads and Liftoff Monetize.

Warning

Remember to replace these test placements with your own placements and setting the test flags to false before your app gets published

import XMediator

#if DEBUG
    let shouldRequestTestAds = true
#else
    let shouldRequestTestAds = false
#endif

// Initialize
let initSettings = InitSettings(test: shouldRequestTestAds)
XMediatorAds.startWith(appKey: "3-15",
                       initSettings: initSettings) { result in
    XMediatorAds.banner.create(placementId: "3-15/28", size: .phone, viewController: self)
    XMediatorAds.interstitial.load(placementId: "3-15/26")
    XMediatorAds.rewarded.load(placementId: "3-15/27")
}
@import XMediatorObjC;

#if DEBUG
    BOOL shouldRequestTestAds = YES;
#else
    BOOL shouldRequestTestAds = NO;
#endif

X3MInitSettings *initSettings = [X3MInitSettings new];
initSettings.test = shouldRequestTestAds;

[X3MXMediatorAds startWithAppKey:@"3-15"
                    initSettings:initSettings
                        callback:^(NSError * _Nullable error) {
    [X3MXMediatorAds.banner createWithPlacementId:@"3-15/28" size:X3MBannerSizePhone viewController:self];
    [X3MXMediatorAds.interstitial loadWithPlacementId:@"3-15/26"];
    [X3MXMediatorAds.rewarded loadWithPlacementId:@"3-15/27"];
}];

Enable verbose logging

Setting the verbose flag to true will output extra logging information to the standard output.

let initSettings = InitSettings(verbose: true)
XMediatorAds.startWith(appKey: "3-15",
                       initSettings: initSettings) { _ in
    // [...]
}
X3MInitSettings *initSettings = [X3MInitSettings new];
initSettings.verbose = YES;

[X3MXMediatorAds startWithAppKey:@"3-15"
                    initSettings:initSettings
                        callback:^(NSError * _Nullable error) {
    // [...]
}];