【问题标题】:How to integrate Chartboost rewarded video with MoPub mediation for iOS如何将 Chartboost 奖励视频与 iOS 的 MoPub 中介集成
【发布时间】:2016-03-21 10:27:34
【问题描述】:

我使用 Cocos2d-x 版本制作游戏。 3.4.我在这个游戏中使用 MoPub 中介制作了奖励视频。我在官方 github wiki 上关注了这个 guide
所以,我首先在项目中加入了 MoPub iOS SDK 和 Chartboost SDK。
我设置在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

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

这是RootViewController.mm 中的按钮“showRewardedVideo”处理程序:

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

我设置在MoPubSDK->AdNetworkSupport->Chartboost->ChartboostRewardedVideoCustomEvent.m:

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

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

但是当我运行应用程序时,我进入了
- (void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration
_networkType 属性 = @"clear" 并收到消息

MOPUB:激励视频广告正在获取广告网络类型:清除

视频没有显示,我从RootViewController.mm-(void)showRewardedVideo方法得到我的警报窗口。

似乎 MoPub 不知道 Chartboost。我想,我需要在initializeRewardedVideoWithGlobalMediationSettings:nil 中定义设置,但我应该怎么做呢?我没有找到这方面的信息。
请告诉我,还需要做什么。任何帮助将不胜感激。

【问题讨论】:

  • 你有没有让这个工作??
  • 不,我建议客户避免使用 MoPub 中介并仅使用 Chartboost。 Chartboost 自己运行良好。

标签: ios ads mopub chartboost


【解决方案1】:

我认为你的问题是没有使用参数:initializeRewardedVideoWithGlobalMediationSettings:nil in loadRewardedVideo in AppDelegate.mm

In your guide 他们声明

中介设置可让您传入第三方网络特定设置,并可在激励视频初始化调用期间作为附加参数提供

所以很可能您需要该参数为非零。此外,如果您不希望 MoPub 自己选择网络,withMediationSettings 应该是非空的。他们说here

中介设置数组应包含广告网络特定对象,这些对象可能会为给定的广告单元 ID 加载

【讨论】:

  • 感谢您的回复。我读了这个。但我不知道如何指定此设置?它们究竟应该包含什么?我在我的 Chartboost SDK 类或 Internet 中找不到这方面的信息。例如,对于Fyber mediation,您应该将 Chartboost 设置添加到 info.plist。但是没有关于 MoPub 的信息。
  • 我也找不到它们的意思。我会代替你做实验。对于initializeRewardedVideoWithGlobalMediationSettings,他们说参数是所有奖励视频广告网络的配置的NSArray所以,我不知道,在@[@"ChartboostInterstitialCustomEvent"] 中输入这个参数,最坏的情况下它会给你一个例外说你应该给它什么样的对象。然后对withMediationSettings 执行相同操作。
  • 有些东西不工作。我在MPRewardedVideo.m 中将设置发送到+(void)loadRewardedVideoAdWithAdUnitID,但我仍然在-(void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration '_networkType' 属性='@“clear”' 中并且没有奖励视频。并且没有错误。感谢您的回复,我会尝试其他方法。
  • 我也有同样的问题。您是否联系过 Mopub/Twitter 支持人员,他们有任何消息?
猜你喜欢
  • 1970-01-01
  • 2020-06-26
  • 2017-07-20
  • 1970-01-01
  • 1970-01-01
  • 2021-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多