Reward Video

app_show_type: 50007

Rewarded video ads are full-screen video ads that users have the option of watching in full in exchange for in-app rewards.

This guide shows you how to integrate rewarded video ads from Orion Ads SDK into an iOS app.

Import Header Files

// if CheetahMobileAds.framework
@import CheetahMobileAds;

// else if CheetahMobileAds.a
#import "CMARequestError.h"
#import "CMARewardVideoAd.h"
#import "CheetahMobileAds.h"

Set up event notifications

@interface viewController ()<CMARewardVideoAdDelegate>

// setup delegate
[CMARewardVideoAd sharedInstance].delegate = self;

The following sample illustrates how to log each of the events available in CMARewardVideoAdDelegate:.

- (void)rewardVideoAdDidReceiveAd:(CMARewardVideoAd *)rewardVideoAd;
- (void)rewardVideoAd:(CMARewardVideoAd )rewardVideoAd didFailToLoadWithError:(CMARequestError )error;
- (void)rewardVideoAdDidOpen:(CMARewardVideoAd *)rewardVideoAd;
- (void)rewardVideoAdDidStartPlaying:(CMARewardVideoAd *)rewardVideoAd;
- (void)rewardVideoAdWillClose:(CMARewardVideoAd *)rewardVideoAd;
- (void)rewardVideoAdWillLeaveApplication:(CMARewardVideoAd *)rewardVideoAd;
- (void)rewardVideoAdDidRewardUser:(CMARewardVideoAd *)rewardVideoAd;

Setup POSID

CMAPosIDConfig *posIDConfig = [[CMAPosIDConfig alloc] 
        initWithOrionPosID:@"YOUR_POSID" liehuPosID:@"YOUR_POSID_FOR_CHINA"];

Load Ads

[[CMARewardVideoAd sharedInstance] loadAdWithPosIDConfig:posIDConfig];

If the ad is loaded, the following function will be called.

-(void)rewardVideoAdDidReceiveAd:(CMARewardVideoAd *)rewardVideoAd;
{
    NSLog(@"You ads is ready to show.")
}

Show Ads

if ([CMARewardVideoAd sharedInstance].isReady) {
    [[CMARewardVideoAd sharedInstance] presentFromRootViewController:self];
}

Last updated