Rewarded Video Ads Integration for iOS

Do go through the steps in our Getting Started Guide to add Media.Net SDK to your project before starting the integration of Rewarded Video Ads.

For adding rewarded video ads to your app, following are the steps:

  • Import the required headers
  • Define an ad slot
  • Set up delegates

Step 1: Import the required headers at the top of the file -

Use the below mentioned line to import the headers


@import MNetAdSdk;


import MNetAdSdk

Or, you can add the headers individually using the below listed lines

#import <MNAdSdk/MNet.h>
#import <MNetAdSdk/MNetRewardedVideo.h>
#import <MNetAdSdk/MNetReward.h>
#import <MNAdSdk/MNetError.h>

Step 2: Defining an ad slot and loading an ad.

The integration of rewarded video ad to your app can be done as the below example.


// DEMO_MN_AD_UNIT_ID is the ad unit id
// Create an instance of MNetRewardedVideo

MNetRewardedVideo *rewardedVideo = [MNetRewardedVideo getInstanceForAdUnitId : DEMO_MN_AD_UNIT_REWARDED];
[rewardedVideo setRewardedVideoDelegate:self];
[rewardedVideo setKeywords:@"bugs, bunny"];
[rewardedVideo setRewardWithName : @"NEW_REWARD" forCurrency :@"INR" forAmount : 100];
[rewardedVideo loadRewardedAd];


let rewardedAdView = MNetRewardedVideo.getInstanceForAdUnitId(DemoConstants.DEMO_MN_AD_UNIT_REWARDED)
rewardedAdView.rewardedVideoDelegate = self
rewardedAdView.setRewardWithName("NEW_REWARD!", forCurrency: "INR", forAmount: 100000)
rewardedAdView.keywords = "bugs, bunny"


MNetRewardedVideo is similar to how MNetInterstialAd works. The rewarded video can be shown using - showAdFromViewController: on the MNetRewardedVideo object, which needs to be called after the ad is loaded (in the rewardedVideoDidLoad callback). The example below illustrates that -


- (void)rewardedVideoDidLoad:(MNetRewardedVideo *)rewardedVideo {
    [rewardedVideo showAdFromViewController:self];


func mnetRewardedVideoDidLoad(_ rewardedVideo: MNetRewardedVideo) {
    rewardedVideo.showAd(from: self);

Step 3: Setting up Delegates

You can listen to the following important delegates in MNetRewardedVideoDelegate -


/// Callback when the rewarded video started
- (void)mnetRewardedVideoDidStart:(MNetRewardedVideo *)rewardedVideo;

/// Callback when the rewared video has completed.
/// This returns the reward object that is set init
- (void)mnetRewardedVideoDidComplete:(MNetRewardedVideo *)rewardedVideo withReward:(MNetReward *)reward;

/// Callback when the rewarded video has completed loading
- (void)mnetRewardedVideoDidLoad:(MNetRewardedVideo *)rewardedVideo;

/// Callback when the rewarded video failed to load
- (void)mnetRewardedVideoDidFailToLoad:(MNetRewardedVideo *)rewardedVideo withError:(MNetError *)error;

/// Callback when the rewarded video is clicked
- (void)mnetRewardedVideoDidClick:(MNetRewardedVideo *)rewardedVideo;

/// Callback when the rewarded video is shown
- (void)mnetRewardedVideoDidShow:(MNetRewardedVideo *)rewardedVideo;


The rewardedVideDidCompleted:withReward: reward dispenses the reward that’s been set by ` setRewardWithName:forCurrency:forAmount:` when making the ad request.