I am trying to port my first game to messenger instant, but I am totaly unable to post or fetch any scores. I have created both global and context related leaderboards, but no luck with either of them. I stil get ' no leaderboard found error'. Am I missing something?
Here is my project flow:
- calling FBInstant.initializeAsync and loading all assets
- once assets are loaded I call FBInstant.startGameAsync
now in code I am trying to post score
function FacebookPostScore(score, leaderboard) { LOG('FacebookPostScore'); FBInstant .getLeaderboardAsync(leaderboard) .then(function(leaderboard){ console.log(leaderboard.getName()); return leaderboard.setScoreAsync(score, '{test: "1", test2: 3}'); }) .then(function(){ console.log('Score saved') }) .catch(function(error){ console.log('ERROR : ' + JSON.stringify(error)); }); };
when I am playing SOLO, context ID is null and I am trying to use GLOBAL leaderboard FacebookPostScore(1000, 'get10')
- when I am playing in group, I am trying to use contextual leaderboard FacebookPostScore(1000, 'main.' + FBInstant.context.getID()
Both times I get only error
ERROR : {"code":"LEADERBOARD_NOT_FOUND","message":"A leaderboard with the name \"main.1692542424140140\" was not found"}
ERROR : {"code":"LEADERBOARD_NOT_FOUND","message":"A leaderboard with the name \"get10\" was not found"}