If you miss to Initialize the SDK, this method will fail to return a response.
All the steps to configure and show the rewarded ad are the same as the interstitial except rewarded ads have an additional callback method onRewardsUnlocked for rewarding the user when they complete watching the ad content.
To create a new rewarded ad, create a MesonInterstitial object.
var rewardedAd: MesonInterstitial = MesonInterstitial.init(adUnitId: "AD_UNIT_ID", delegate: self)
MesonInterstitial *rewardedAd = [[MesonInterstitial alloc] initWithAdUnitId:@"AD_UNIT_ID" delegate:self];
Track the ad lifecycle for rewarded ads. All the available events for rewarded ads are listed below.
extension <Class> : MesonInterstitialDelegate {
func mesonInterstitialDidLoad(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidFailToLoad(_ interstitialAd: MesonInterstitial, error: Error) {
}
func mesonInterstitialImpression(_ interstitialAd: MesonInterstitial, adData: MesonAdData?) {
}
func mesonInterstitialDidFailToDisplay(_ interstitialAd: MesonInterstitial, error: Error) {
}
func mesonInterstitialUserWillLeaveApplication(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialWillDisplay(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidDisplay(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialWillDismiss(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidDismiss(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidClick(_ interstitial: MesonInterstitial, params: [String : Any]?) {
}
func mesonRewardsUnlocked(_ interstitial: MesonInterstitial, rewards: [String : Any]) { }
}
- (void)mesonInterstitialDidLoad:(MesonInterstitial *)interstitialAd {
}
- (void)mesonInterstitialDidFailToLoad:(MesonInterstitial *)interstitialAd error:(NSError *)error {
}
- (void)mesonInterstitialDidFailToDisplay:(MesonInterstitial *)interstitialAd error:(NSError *)error{
}
- (void)mesonInterstitialImpression:(MesonInterstitial *)interstitialAd adData:(MesonAdData *)adData{
}
- (void)mesonInterstitialDidClick:(MesonInterstitial *)interstitial params:(NSDictionary<NSString *,id> *)params {
}
- (void)mesonInterstitialUserWillLeaveApplication:(MesonInterstitial *)interstitialAd {
}
- (void)mesonInterstitialWillDisplay:(MesonInterstitial *)interstitialAd {
}
- (void)mesonInterstitialDidDisplay:(MesonInterstitial *)interstitialAd {
}
- (void)mesonInterstitialDidDismiss:(MesonInterstitial *)interstitialAd {
}
- (void)mesonInterstitialWillDismiss:(MesonInterstitial *)interstitialAd {
}
- (void)mesonRewardsUnlocked:(MesonInterstitial *)rewardedAd rewards:(NSDictionary<NSString *,id> *)rewards {
}
The publisher can request a rewarded ad by invoking this method. This will request an ad from all demand sources, select a winner, and make it available on the SDK.
rewardedAd.load()
[rewardedAd load];
The ad is available when the load is called. It is shown to the user when the show method is called. It is recommended to check isReady
method and then call the show method.
rewardedAd.show(from: <UIViewController>)
[rewardedAd showFromViewController:<ViewController>];