Test mode iOS

It's possible to enable loading test advertisements for certain device(s).

Adding test device:

  1. Enable Debug Mode and make an ad request.
  2. Look for Instance Id in device's console or in Xcode's debug area:
[myTarget debug] Current device's Instance Id is D346D6CE-3414-4C22-BFC8-B4DD4983B1C8, use this value in method withTestDevices() on ad instance in order to enable Test Mode.
Copy Instance Id of test device to clipboard.

3. Add following method call to your code withTestDevices:(nullable NSArray<NSString *> *) and pass Instance Id of test divice(s):
MTRGNativeAd *nativeAd = [[MTRGNativeAd nativeAdWithSlotId:12345] withTestDevices:@[@"D346D6CE-3414-4C22-BFC8-B4DD4983B1C8"]];
MTRGNativeAd *nativeAd = [MTRGNativeAd nativeAdWithSlotId:12345];
[nativeAd withTestDevices:@[@"D346D6CE-3414-4C22-BFC8-B4DD4983B1C8", @"D346D6CE-3414-4C22-BFC8-B4DD4983B1C8"]];
4. Restart application, then test ad will appear on added device(s).
5. Make sure that test device isn't set on production.
Was this article helpful?