Rewarded ads are ads that users have the option of interacting with in exchange for in-app rewards. This guide shows you how to integrate rewarded ads from Adx3 into an iOS app.
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. The easiest way to load test ads is to use our dedicated test ad unit ID for app-rewarded ads:
63a573b533f6f
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
Implementation
The main steps to integrate interstitial ads are:
Load an ad.
Register for callbacks.
Display the ad and handle the event.
Load an ad
Loading an ad is accomplished using the static loadAdWithPlacementID:userId:delegate: method on the Adx3RewardAd class. The load method requires your ad unit ID, a userId object, and a delegate object which gets called when ad loading succeeds or fails. UserId object cannot be passed, nor can your custom user identifier. The below example shows how to load an Adx3RewardAd in your ViewController class.
importUIKitclassViewController:UIViewController {overridefuncviewDidLoad() { super.viewDidLoad()loadRewardAd()// Do any additional setup after loading the view. }funcloadRewardAd() { Adx3RewardAd.sharedManager().load(withPlacementID:"Your Placement ID", userId:"", delegate: self) }}
You should rely on the Adx3RewardDelegate (optional) to handle display events and request events. The following code shows how to implement the protocol:
Before displaying a rewarded ad to users, you must present the user with an explicit choice to view rewarded ad content in exchange for a reward. Rewarded ads must always be an opt-in experience.
The following code presents the best method for displaying a rewarded ad.