2016-03-21 16 views
0

私はCocos2d-x verを使ってゲームを作っています。 3.4。私はこのゲームでMoPub調停で報酬を与えられたビデオを作ります。私はこのguideを公式のgithub wikiに載せました。
まず、MoPub iOS SDKとChartboost SDKをプロジェクトに組み込みました。
私はAppDelegate.hに設定:AppDelegate.mmChartboostの報酬ビデオとiOSのMoPub調停の統合方法

#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 

を:

@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]); 
     } 
    } 
} 

これは、ボタン "showRewardedVideo" RootViewController.mmでハンドラです:私はMoPubSDKに設定

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

- >AdNetworkSupport - >Chartboost - >ChartboostRewardedVideoCustomEvent.m

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

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

しかし、私はアプリケーションを実行すると、私は
- (void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration
で取得_networkType propertie = @"clear" とメッセージが表示されます

MOPUB:動画広告は、広告ネットワークの種類をフェッチしている報われる:クリア

ビデオは表示されず、アラートウィンドウが表示されますRootViewController.mm-(void)showRewardedVideoから。

MoPubはChartboostについて知りません。私はinitializeRewardedVideoWithGlobalMediationSettings:nilで設定を定義する必要があると思いますが、どうすればいいですか?これについての情報は見つかりませんでした。
他に何が必要なのか教えてください。どんな助けもありがとう。

+0

のためにロードすることができるネットワークのために広告ネットワークの特定のオブジェクトが含まれている必要があります? – Jan

+0

いいえ、私は顧客がMoPub調停を避け、Chartboostだけを使用するよう提案しました。 Chartboost自身はうまく動作します。 – alc77

答えて

0

私はあなたの問題は何も引数を使用していないと思う:AppDelegate.mmloadRewardedVideoinitializeRewardedVideoWithGlobalMediationSettings:nil

In your guide彼らは

仲介設定は、サードパーティ製のネットワーク内の特定の設定を渡すことができますし、として提供することができると述べています報酬を与えられたビデオ初期化コールの間の追加パラメータ

あなたはおそらくその引数t o非ゼロであること。また、MoPubがネットワークを単独で選択したくない場合は、withMediationSettingsはnullでなくてはなりません。彼らはhereそれを言う:

調停設定の配列は、あなたが今までこの作業を取得しました指定された広告ユニットID

+0

ありがとうございます。私はこれを読む。しかし、私はこの設定を指定する方法を知らない?それらには正確に何が含まれていますか? ChartboostのSDKクラスやインターネットでこれに関する情報を見つけることができません。たとえば、[Fyber mediation](http://developer.fyber.com/content/current/ios/rewarded-video/adding-networks/chartboost/)では、Chartboost設定をinfo.plistに追加する必要があります。しかし、MoPubの情報はありません。 – alc77

+0

私はそれらが意味するものを見つけることができません。私はあなたのところで実験します。 'initializeRewardedVideoWithGlobalMediationSettings'のために、彼らは引数がすべての報酬を与えられたビデオ広告ネットワークのための_configurationsのNSArrayであると言っていますので、私はこの引数を' @ [@ "ChartboostInterstitialCustomEvent"] 'に送ります。最悪の場合、あなたがそれに与えるべきオブジェクトの種類。その後、 'withMediationSettings'に対しても同じことをします。 –

+0

何かが動作しません。私は 'MPRewardedVideo.m'の' +(void)loadRewardedVideoAdWithAdUnitID'に設定を送りますが、 ' - (void)communicatorDidReceiveAdConfiguration :(MPAdConfiguration *)設定' ''_networkType' propertie = '@" clear "'とno報酬を与えられたビデオ。そしてエラーはありません。返信いただきありがとうございます、私は他の何かを試してみます。 – alc77

関連する問題