Search code examples
facebook-instant-games

failed to submit Leaderboard score in facebook instant games


I am not able to submit score on leaderboard. Also, i am very new to javascript, so i dont know exactly how to catch error thrown by setScoreAsync



    FBInstant.getLeaderboardAsync('global')
          .then(function(leaderboard) {     
            return leaderboard.setScoreAsync(gameManager.highscore);
          })
          .then(function(entry) {
            console.log(entry.getScore()); // 42
            console.log(entry.getPlayer().getName());
          }
          });

Please help me.


Solution

  • You need to configure 'global' leaderboard in developer dashboard (with "Make leaderboard contextual" option set to 'NO'). Use:

    .catch(function (err)
    {
        console.log(err);
    });
    

    for catching errors, the same way like .then()