anand edited this page May 10, 2016 · 30 revisions
Clone this wiki locally


The CrossChannel iOS SDK enables high volume iOS publishers to earn high CPMs via highly engaging display interstitials, video ads and rewarded video. Banner formats have been deprecated as of version 3.6 along with framed and styled ads.

  • Current CrossChannel SDK Version: 3.6.2 (October 18, 2015 Release)
  • iOS Version Support: 6.0+
  • Supported formats: Display Interstitials, Video Ads, Rewarded Video Ads, Native Ads
  • Supported Setups: Standalone SDK, Google Admob, Twitter Mopub, Yahoo Flurry, Unity, PhoneGap, ANE

The general process is:

How to Add the iOS SDK to your iOS Application

The following are the list of files that are part of CrossChannel SDK 3:

  • MdotMInterstitial.h
  • MdotMInterstitialDelegate.h
  • MdotMRequestParameters.h
  • MdotMNativeAd.h
  • MdotMNativeDelegate.h
  • MdotMNativeView.h
  • libMdotMSDK3.a

To add the SDK to your project:

  • Drag and drop all four CrossChannel SDK files into the project, making sure the “copy items to destination group’s folder” is selected.
  • Select the target name in Add to Targets section.
  • Import the following header files, inside the class where the Interstitial Ad View has to be displayed. "MdotMInterstitial.h" "MdotMInterstitialDelegate.h" "MdotMRequestParameters.h"
  • Link dependent Frameworks and libraries by going to Build phases for that target. In the "Link Binary with Libraries" section, add following frameworks and libraries. libz.dylib libxml2.dylib SystemConfiguration.framework MobileCoreServices.framework CFNetwork.framework UIKit.framework Foundation.framework CoreGraphics.framework QuartzCore.framework

Display Interstitials and Video

a. Import MdotMInterstitial.h header file

b. Create the MdotMInterstitial

MdotMInterstitial *intlView = [[MdotMInterstitial alloc]init]; 

c. The following are the parameter values for MdotMRequestParameters:

MdotMRequestParameters *requestParameters;
requestParameters = [[MdotMRequestParameters alloc]init];
requestParameters.appKey = @"[insert your app key here]";

d. Set the delegate for the interstitial view to the view controller class.

intlView.interstitialDelegate = self; 

if video ads are required then set test as video otherwise interstitial ads will be received

requestParameters.test = @"video"; // To get video ads

and load the Interstitial via a call to loadInterstitialAd, and pass the requestParameters object.

[intlView loadInterstitialAd:requestParameters];

where requestParameters is an object of MdotMRequestParameters class which is described in detail above.

e. Implement the delegate functions

- (void) onReceiveInterstitialAd;
- (void) onReceiveInterstitialAdError:(NSString *)error;
- (void) onReceiveClickInInterstitialAd;
- (void) willShowModalViewController; 
- (void) didShowModalViewController;
- (void) willDismissModalViewController;
- (void) didDismissModalViewController; 
- (void) willLeaveApplication;

For displaying the interstitial, call showInterstitial function and pass the current view controller object as parameter, and a parameter for animation. Since showInterstitial can be called only after the interstitial has downloaded, wait for the interstitial delegate function onReceiveInterstitialAd to get called and then whenever you want to show the ad, invoke the showInterstitial method.

- (void) onReceiveInterstitialAd
  [self performSelectorOnMainThread:@selector(displayAd) withObject:nil waitUntilDone:NO];
- (void) displayAd {
  // 'self' object should be the active view controller
  [intlView showInterstitial:self animated:YES];

Rewarded Video

The implementation of Rewarded Video is the same as Interstitials except instead of calling showInterstitial you should call loadRewardedVideo with a reward parameter (e.g. "Gems" or "Jewel")

- (BOOL) loadRewardedVideo:(MdotMRequestParameters *)request reward:(NSString*)reward;


[intlView loadRewardedVideo:request reward:rewardItem]

which will attempt to fetch the rewarded video from CrossChannel. For displaying the rewarded video, call showInterstitial in the delegate function onReceiveInterstitialAd and pass the current view controller object as parameter, and a parameter for animation:

- (void) onReceiveInterstitialAd 
  [self performSelectorOnMainThread:@selector(displayRewardedAd) withObject:nil waitUntilDone:NO];

- (void) displayRewardedAd 
  // 'self' object should be the active view controller
  [intlView showInterstitial:self animated:YES];

Finally, implement the delegate method:

- (void) onRewardedVideoComplete:(BOOL)isSkipped reward:(NSString*)reward;

If the user completes the video, isSkipped is NO and the user should be rewarded.

If the user skips the video, isSkipped is YES and the user should not be rewarded.

The additional reward parameter should be used in applications where multiple kinds of rewards can be offered to the user. If there is no ambiguity in reward, an empty string can be provided.

Native Ads

CrossChannel's Native Ad SDK enables high volume publishers to maximize user experience and monetization performance.

Key Steps:

a. Import the MdotMNativeView.h & MdotMNativeDelegate.h header file

b. Create the MdotMNativeView

MdotMNativeView *nativeView = [[MdotMNativeView alloc] init];                                                                     

and set up the parameter values for MdotMRequestParameters:

MdotMRequestParameters *requestParameters;                                                                                    
requestParameters = [[MdotMRequestParameters alloc] init];                                                                    
requestParameters.appKey = @"[insert your app key here]";                                                                     
requestParameters.test = @"native"; 

c. Set the delegate for the native view to the view controller class.

nativeView.nativeDelegate = self;                                                                                             

and then load the native ad via a call to loadNativeAd, and pass the requestParameters object.

[nativeView loadNativeAd:requestParameters];                                                                                  

d. Now implement the key delegate functions that is invoked when list of native ads are loaded:

- (void) onReceiveNativeAd:(NSArray*)nativeAdArray;                                                                        

and when an ad fails to load:

- (void) onFailedToReceiveNativeAd:(NSError *)error;                                                                        

When a native ad loads, it is ready to be shown in your app. This can be done in the first delegate method as follows:

- (void) onReceiveNativeAd:(NSArray*)nativeAdArray   
   MdotMNativeAd *nativeAd = [nativeAdArray objectAtIndex:requiredIndexNumber];
   NSString *title = nativeAd.title;  // 25 chars
   NSString *body = nativeAd.body;  // 100 chars
   MdotMAdImage *coverImage = nativeAd.coverImage; // 1200x627 
   MdotMAdImage *icon = nativeAd.icon; // 80x80                                                                               
   NSString *callToAction = nativeAd.callToAction;                                                                            
   // Creates a custom UIView that uses above properties
   UIView *nativeAdView  = [[UIView alloc] initWithFrame:adFrame];                                                             
   UILabel *titleLabel = [[UILabel alloc] initWithFrame:titleFrame];                                                           
   titleLabel.text = title;                                                                                                    
   [nativeAdView addSubview:titleLabel];                                                                                       
   // Add the ad to the view hirarchy
   [self.view addSubview:nativeAdView];                                                                                        
   // Register the native ad view and its view controller with the native ad instance
   [self.nativeView registerView:nativeAdView withNativeID:nativeAd.nativeID withViewController:self];

The follow MdotMNativeAd properties will always have values:

  • title - 25 chars
  • body - 100 chars
  • icon - 80x80 image
  • coverImage - 1200x627 image
  • callToAction - 8 chars and should be used to form the native ad view. Ad metadata that you receive can be cached and re-used for up to 24 hours.

The SDK will log the impression and handle the click automatically via the registerView call, which makes the whole view clickable.

Note that the view controller that is passed must take the full screen of the device, otherwise clicking ads may not show the landing page or app store page correctly.

e. To re-use the view to show different ads over time, call unregisterView before registering the same view with a different instance of MdotMNativeAd.

[self.nativeView unregisterView:nativeAdView];                                                                                     

Sample Application

The sample application on git hub will provide a working example of the CrossChannel SDKs for display and rewarded cases:

Add AppKey and Compile in xCode

Use APPKEY in Xcode

Compiling the App

Sample Interstitial Ad

Sample Rewarded Video Ad

Testing and Troubleshooting

When testing, you can set test to 1 to get test ads

requestParameters.test = @"1"; // General testing 

or to video to get test video ads specifically

requestParameters.test = @"video"; // To get video ads only

or to native to get test native ads specifically

requestParameters.test = @"native"; 

This will ensure you get 100% fill.

Conversely, if you want to test a lack of fill (e.g. to force testing of finding another ad in the waterfall), set test to nofill:

requestParameters.test = @"nofill"; // Lack of fill testing 

When releasing your application, be sure to return back to:

requestParameters.test = @"0";


Email sdksupport@CrossChannel.com for assistance - we are happy to help!