Facebook Instant Game-上传捆绑的zip文件会导致Web Hosting出现SDK参考错误 [英] Facebook Instant Game - Uploading bundled zip file gives SDK reference error from Web Hosting

查看:99
本文介绍了Facebook Instant Game-上传捆绑的zip文件会导致Web Hosting出现SDK参考错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试上传简单的游戏/应用程序时,出现错误提示

When I try to upload my simple game/app, I get an error saying

游戏必须通过CDN引用我们支持的SDK之一."

"Games must reference one of our supported SDKs via our CDN."

我已经给出了一个SDK参考.这不是那个吗?

I have given an SDK reference though. Isn't this the one?

<script src="https://connect.facebook.net/en_US/fbInstant.6.2.js"></script>

我也通过了facebook docs的SDK参考,但是对我不起作用? 有没有人以前遇到过同样的情况或有解决此问题的想法?谢谢

I went through the SDK reference of facebook docs as well but it didn't work for me? Did anyone face same situation before or have an idea to fix this problem? thank you

我有一个文件index.html

I have a file index.html

INDEX.HTML

 <html>
  <head>
    <title>
        this is test
</title>
<style>
body {
  width: 400px;
  height: 400px;
  position: 0;
  background: yellow;
 }
    #heading1{

  position: absolute;

}
    </style>
</head>

<body>
<h1 id="heading1">
This is h1.
</h1>
<button onclick="myFunction()">Move the heading</button>
<script>
var ran = Mathfloor.Math.Random()*1;
function myFunction() {
var move= document.getElementById("heading1");
 var pos = 0;
  var id = setInterval(frame, 5);
  function frame() {
if (pos == 350) {
 clearInterval(id);
  var id1 = setInterval(framenext, 5);
} else {
  pos++; 
  if (ran ==1) {
  move.style.top = pos + "px"; }else {
  move.style.left = pos + "px"; }
}
}
     function framenext() {
if (pos == 0) {
  clearInterval(id1);
  var id = setInterval(framenext, 5);
} else {
  pos--; 
  if (ran ==1) {
  move.style.top = pos + "px"; }else {
  move.style.left = pos + "px"; }
   }
   }

    }
</script>
<script src="https://connect.facebook.net/en_US/fbInstant.6.2.js"</script>
    </body>
</html>

fbapp-config.json

 {
    "instant_games":{
     "navigation_menu_version": "NAV_FLOATING",
     }
  }

推荐答案

<body>
<script src="https://connect.facebook.net/en_US/fbinstant.6.2.js"></script>
<h1 id="heading1">
    This is h1.
</h1>
<button onclick="myFunction()">Move the heading</button>
<script>
    window.onload = function () {
        FBInstant.initializeAsync().then(function () {
            FBInstant.setLoadingProgress(100);
        });
        FBInstant.startGameAsync().then(function () {
            startGame();
        })
    };
</script>
<script>
    var ran = Math.floor(Math.random() * 1);
    your script codes here...
</script>
</body>
</html>

fbapp-config.json

fbapp-config.json

{
  "instant_games": {
    "platform_version": "RICH_GAMEPLAY",
    "orientation": "LANDSCAPE",
    "navigation_menu_version": "NAV_FLOATING"
  }
}

fbapp-config.json必须至少具有这三个键值对 游戏开始.

fbapp-config.json must have at least these three key-value pairs for the game to start.

测试成功.

这篇关于Facebook Instant Game-上传捆绑的zip文件会导致Web Hosting出现SDK参考错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆