1

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"}

This is how it looks in chrome console

James Skemp
  • 8,018
  • 9
  • 64
  • 107
  • You haven't given us much to work with. Can you post any relevant code to show us what you're doing? I'm not familiar with these leaderboards but I assume you've got a GUID or token for each one that you're referencing from an app on the same account? – Rup Mar 21 '18 at 23:39
  • I updated it. It should give you more info now – Peter Brezky Brezovan Mar 22 '18 at 08:12
  • The leader board must work in a context. You call FBInstant.context.chooseAsync().then(function () {FBInstant.context.getID() } to get contextID – tuananh Mar 23 '18 at 01:57
  • FacebookPostScore(1000, 'main.' + FBInstant.context.getID() – Peter Brezky Brezovan Mar 23 '18 at 10:02

1 Answers1

0

I was almost a day, in the end I managed to save a score by creating a test application of the same "application -test1", create a leaderboards and I succeeded in saving it. I will try creating a new application from scratch maybe that is the solution. I'll let you know if I'm successful.

  • Ai have already tried to delete App and create new one. Still no luck... – Peter Brezky Brezovan Mar 23 '18 at 10:03
  • I have tried to use leaderboard names from demo ('All Friends' and 'Time Attack') and it works. I have created two projects, but it works only in one which is totally strange and one even stranger thing. Leaderboard 'All Friends' returns three people with scores and everything but my game was created several minutes ago and I am pretty sure, that no one else played it – Peter Brezky Brezovan Mar 24 '18 at 18:40