title: How to integrate Chartboost rewarded video with MoPub mediation for iOS
body: <p>I make the game using Cocos2d-x ver. 3.4. I make the rewarded video with MoPub mediation in this game. I followed this <a href="https://github.com/mopub/mopub-ios-sdk/wiki/Rewarded-Video-Integration" rel="nofollow">guide</a> on official github wiki.<br>
  So, first I incorporated the MoPub iOS SDK and Chartboost SDK in the project.<br>
   I set in <code>AppDelegate.h</code>:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "MoPub.h"
  #import "MPRewardedVideo.h"
  
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate, MPRewardedVideoDelegate&gt;
  
  @property (strong, nonatomic) UIWindow *window;
  @property (nonatomic, assign) NSInteger coinAmount;
  
  @end
  </code></pre>
  
  <p>in <code>AppDelegate.mm</code>:</p>
  
  <pre><code>@implementation AppDelegate
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      …
      [self loadRewardedVideo];
  
      return YES;
  }
  
  - (void)loadRewardedVideo {
      [[MoPub sharedInstance] initializeRewardedVideoWithGlobalMediationSettings:nil delegate:self];
  
      [MPRewardedVideo loadRewardedVideoAdWithAdUnitID:@“[MyAdUnitID]“ withMediationSettings:nil];
  }
  
  #pragma mark - MPRewardedVideoDelegate
  
  - (void)rewardedVideoAdShouldRewardForAdUnitID:(NSString *)adUnitID reward:(MPRewardedVideoReward *)reward {
      if ([reward.currencyType isEqualToString:@"coin"]) {
          if ([reward.amount integerValue] == kMPRewardedVideoRewardCurrencyAmountUnspecified)
          {
              singleton-&gt;addToTotalCoins(10); // for test
          } else
          {
              singleton-&gt;addToTotalCoins([reward.amount integerValue]);
          }
      }
  }
  </code></pre>
  
  <p>This is buttons "showRewardedVideo" handler in <code>RootViewController.mm</code>:</p>
  
  <pre><code>#import "RootViewController.h"
  
  @implementation RootViewController
  
  - (void) showRewardedVideo
  {
      if ([MPRewardedVideo hasAdAvailableForAdUnitID:@"MyAdUnitID"])
      {
          [MPRewardedVideo presentRewardedVideoAdForAdUnitID:@"MyAdUnitID" fromViewController:self];
      }
      else
      {
          UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                              message:@"Something went wrong"
                                                             delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
          [alertView show];
      }
  }
  </code></pre>
  
  <p>I set in <code>MoPubSDK</code>-><code>AdNetworkSupport</code>-><code>Chartboost</code>-><code>ChartboostRewardedVideoCustomEvent.m</code>:</p>
  
  <pre><code>- (void)requestRewardedVideoWithCustomEventInfo:(NSDictionary *)info
  {
      NSString *appId = [info objectForKey:@"MyChartboostAppID"];
  
      NSString *appSignature = [info objectForKey:@"MyChartboostAppSignature"];
  …
  }
  </code></pre>
  
  <p>But when I run the application, I get in<br>
   <code>- (void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration</code><br>
  the <code>_networkType</code> propertie = <code>@"clear"</code>
  and get a message    </p>
  
  <blockquote>
    <p>MOPUB: Rewarded video ad is fetching ad network type: clear</p>
  </blockquote>
  
  <p>The video is not displayed, and I get my alert window from <code>RootViewController.mm</code>  <code>-(void)showRewardedVideo</code> method.</p>
  
  <p>Seems MoPub doesn't know about Chartboost. I think, I need define settings in <code>initializeRewardedVideoWithGlobalMediationSettings:nil</code>, but how I should make this? I didn't found info about this.<br>
  Please tell me, what else needs to be done. Any help will be appreciated.</p>