简体   繁体   English

即时游戏广告不起作用 - showAsync' of null

[英]Instant game ads not working - showAsync' of null

I am trying to add monetization to my Facebook instant game, it is created via Cocos Creator.我正在尝试将货币化添加到我的 Facebook 即时游戏中,它是通过 Cocos Creator 创建的。 I have checked in project settings Facebook audience network and also build game as instant game.我已经检查了项目设置 Facebook 受众网络,并将游戏构建为即时游戏。 (Cocos Creator has integrated the Facebook Instant Games SDK and it automatically initializes (initializeAsync and startGameAsync) when the game is loaded.) My app was approved and I tried ads also in live mode. (Cocos Creator 已经集成了 Facebook Instant Games SDK,它会在游戏加载时自动初始化(initializeAsync 和 startGameAsync)。)我的应用程序被批准了,我也在实时模式下尝试了广告。 I tested ads from browser also from mobile.我也测试了来自移动设备的浏览器广告。 Interstitial ads should work from browser but I am still getting this error: Uncaught TypeError: Cannot read property 'showAsync' of null or Interstitial failed to preload: Client does not support the message: getinterstitialadasync插页式广告应该可以在浏览器中工作,但我仍然收到此错误:未捕获的类型错误:无法读取 null 的属性“showAsync”插页式广告无法预加载:客户端不支持消息:getinterstitialadasync

my code looks like this:我的代码是这样的:

showInterstitialAd: function () {

    var preloadedInterstitial = null;

    FBInstant.getInterstitialAdAsync(
        '1111111111111' // Your Ad Placement Id
    ).then(function (interstitial) {
        // Load the Ad asynchronously
        preloadedInterstitial = interstitial;
        return preloadedInterstitial.loadAsync();
    }).then(function () {
        console.log('Interstitial preloaded');
    }).catch(function (err) {
        console.error('Interstitial failed to preload: ' + err.message);
    });

    preloadedInterstitial.showAsync()
        .then(function () {
            // Perform post-ad success operation
            console.log('Interstitial ad finished successfully');
        })
        .catch(function (e) {
            console.error(e.message);
        });
},

What am I missing?我错过了什么? thank you谢谢你

可能您没有遗漏任何东西,Facebook 即时游戏插页式广告只有在您通过 3K mps 后才能使用,现在您只能使用奖励视频和应用内购买。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM