0

I make the game using Cocos2d-x ver. 3.4. I make the rewarded video with MoPub mediation in this game. I followed this guide on official github wiki.
So, first I incorporated the MoPub iOS SDK and Chartboost SDK in the project.
I set in AppDelegate.h:

#import <UIKit/UIKit.h>
#import "MoPub.h"
#import "MPRewardedVideo.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate, MPRewardedVideoDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, assign) NSInteger coinAmount;

@end

in AppDelegate.mm:

@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->addToTotalCoins(10); // for test
        } else
        {
            singleton->addToTotalCoins([reward.amount integerValue]);
        }
    }
}

This is buttons "showRewardedVideo" handler in RootViewController.mm:

#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];
    }
}

I set in MoPubSDK->AdNetworkSupport->Chartboost->ChartboostRewardedVideoCustomEvent.m:

- (void)requestRewardedVideoWithCustomEventInfo:(NSDictionary *)info
{
    NSString *appId = [info objectForKey:@"MyChartboostAppID"];

    NSString *appSignature = [info objectForKey:@"MyChartboostAppSignature"];
…
}

But when I run the application, I get in
- (void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration
the _networkType propertie = @"clear" and get a message

MOPUB: Rewarded video ad is fetching ad network type: clear

The video is not displayed, and I get my alert window from RootViewController.mm -(void)showRewardedVideo method.

Seems MoPub doesn't know about Chartboost. I think, I need define settings in initializeRewardedVideoWithGlobalMediationSettings:nil, but how I should make this? I didn't found info about this.
Please tell me, what else needs to be done. Any help will be appreciated.

  • Did you ever get this to work?? – Jan Aug 22 '16 at 13:43
  • No, I proposed the customer avoid the MoPub mediation and use only Chartboost. Chartboost himself works fine. – alc77 Aug 25 '16 at 13:31
0

I think your problem is using no argument: initializeRewardedVideoWithGlobalMediationSettings:nil in loadRewardedVideo in AppDelegate.mm

In your guide they state that

Mediation settings enable you to pass in third-party network specific settings and can be provided as additional parameters during the rewarded video initialization call

so most probably you need that argument to be non-nil. Also, withMediationSettings should be non-null if you don't want MoPub to choose network by itself. They say it here:

The mediation settings array should contain ad network specific objects for networks that may be loaded for the given ad unit ID

  • Thank you for response. I read this. But I don't know how to specify this settings? What exactly should they contain? I can't found info about this in my Chartboost SDK classes or in the Internet. For example, for Fyber mediation you should to add Chartboost settings into info.plist. But there is no information for MoPub. – alc77 Mar 21 '16 at 11:26
  • I can't find what they mean either. I would experiment in your place. for initializeRewardedVideoWithGlobalMediationSettings they say argument is NSArray of configurations for all rewarded video ad networks so, I don't know, feed this argument in there @[@"ChartboostInterstitialCustomEvent"], worst case it will give you an exception saying what kind of objects you should give to it. Then do same for withMediationSettings. – Nika Kasradze Mar 21 '16 at 11:38
  • Something does not work. I send settings to +(void)loadRewardedVideoAdWithAdUnitID in MPRewardedVideo.m, but I get still in -(void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration the '_networkType' propertie = '@"clear"' and no rewarded video. And no errors. Thank you for response, I'll try something else. – alc77 Mar 21 '16 at 15:12
  • I have the same problem. Did you contact Mopub/Twitter support, any news from their side? – thomers May 27 '16 at 11:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.