typescript - Die Website lädt weiterhin bei 0 %, wenn ein Facebook Instant Game auf einem HTTPS-Server getestet wird
Entschuldigung für mein schlechtes Englisch, ich mache die Sache (mein Projekt testen) genau wie im offiziellen Dokument (https://developers.facebook.com). Ich teste mein Zertifikat mit Befehlen, keine Fehler. Als ich einen HTTPS-Server gemacht habe, gab es auch keine Fehler. Sie können das Projekt hier finden: developers.facebook.com.
Zuerst teste ich localhost:8080, es zeigt mir unsicher und https ist rot, wenn das Projekt eingebettet ist, ja, die URL ist https://www.facebook.com/embed/instantgames/YOUR_GAME_ID/player?game_url=https://localhost:8080 und diesmal scheint die Website nicht zu funktionieren, sie lädt weiterhin bei 0%. Ich weiß nicht warum. Könnte mir bitte jemand helfen? Danke für jede Hilfe!
Antwort #1
Sie müssen der API tatsächlich mitteilen, dass Sie mit dem Laden fertig sind. Der Mindestcode ist auf dieser Seite zu finden und sieht folgendermaßen aus:
<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>
