簡體   English   中英

Facebook Instant Game - 上傳捆綁的 zip 文件會導致來自 Web 托管的 SDK 參考錯誤

[英]Facebook Instant Game - Uploading bundled zip file gives SDK reference error from Web Hosting

當我嘗試上傳我的簡單游戲/應用程序時,我收到一條錯誤消息

“游戲必須通過我們的 CDN 引用我們支持的 SDK 之一。”

不過我已經給出了 SDK 參考。 不是這個嗎?

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

我也瀏覽了 facebook 文檔的 SDK 參考,但它對我不起作用? 以前有沒有人遇到過同樣的情況或者有解決這個問題的想法? 謝謝你

我有一個文件 index.html

索引.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

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

fbapp-config.json 必須至少有這三個鍵值對才能開始游戲。

測試成功。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM