[英]The website is continue loading at 0% when testing a Facebook instant game on https server
抱歉我的英語不好,我就像在官方文檔( https://developers.facebook.com )中那樣做(測試我的項目)。 我用命令測試我的證書,沒有錯誤。 當我制作https服務器時,也沒有錯誤。 您可以在這里找到該項目:developers.facebook.com。
首先,我測試localhost:8080
,它顯示我不安全,https是紅色,當項目嵌入時,是的,網址是https://www.facebook.com/embed/instantgames/YOUR_GAME_ID/player?game_url=https://localhost:8080
這個網站似乎沒有用,它繼續加載0%。 我不知道為什么。 有人可以幫幫我嗎? 謝謝你的幫助!
您必須實際通知API您已完成加載。 最小代碼可以在此頁面上找到,如下所示:
<script src="https://connect.facebook.net/en_US/fbinstant.6.2.js"></script>
<script>
FBInstant.initializeAsync()
.then(function() {
});
// Once all assets are loaded, tells the SDK
// to end loading view and start the game
FBInstant.startGameAsync()
.then(function() {
// Retrieving context and player information can only be done
// once startGameAsync() resolves
var contextId = FBInstant.context.getID();
var contextType = FBInstant.context.getType();
var playerName = FBInstant.player.getName();
var playerPic = FBInstant.player.getPhoto();
var playerId = FBInstant.player.getID();
// Once startGameAsync() resolves it also means the loading view has
// been removed and the user can see the game viewport
game.start();
});
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.