首页 > 解决方案 > 即时游戏广告不起作用 - showAsync' 为 null

问题描述

我正在尝试将货币化添加到我的 Facebook 即时游戏中,它是通过 Cocos Creator 创建的。我已经检查了项目设置 Facebook 受众网络,并将游戏构建为即时游戏。(Cocos Creator 集成了 Facebook Instant Games SDK 并在游戏加载时自动初始化(initializeAsync 和 startGameAsync)。)我的应用程序获得批准,我也在直播模式下尝试了广告。我测试了来自浏览器的广告也来自移动设备。插页式广告应该可以从浏览器工作,但我仍然收到此错误: 未捕获的类型错误:无法读取 null 的属性“showAsync”插页式广告无法预加载:客户端不支持消息:getinterstitialadasync

我的代码如下所示:

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

我错过了什么?谢谢你

标签: facebook-instant-gamescocoscreatorfacebook-monetization-manager

解决方案


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


推荐阅读