私はCocos2d-x verを使ってゲームを作っています。 3.4。私はこのゲームでMoPub調停で報酬を与えられたビデオを作ります。私はこのguideを公式のgithub wikiに載せました。
まず、MoPub iOS SDKとChartboost SDKをプロジェクトに組み込みました。
私はAppDelegate.h
に設定:AppDelegate.mm
でChartboostの報酬ビデオと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
で設定を定義する必要があると思いますが、どうすればいいですか?これについての情報は見つかりませんでした。
他に何が必要なのか教えてください。どんな助けもありがとう。
のためにロードすることができるネットワークのために広告ネットワークの特定のオブジェクトが含まれている必要があります? – Jan
いいえ、私は顧客がMoPub調停を避け、Chartboostだけを使用するよう提案しました。 Chartboost自身はうまく動作します。 – alc77