简体   繁体   中英

FBInstant.player.getConnectedPlayersAsync() always returns empty

my code is:

let global_config = {

};
window.onload = function (e) {
  FBInstant.initializeAsync()
    .then(function () {
      FBInstant.startGameAsync()
        .then(function () {
          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();

          global_config["contextId"] = contextId;
          global_config["contextType"] = contextType;
          global_config["playerName"] = playerName;
          global_config["playerPic"] = playerPic;
          global_config["playerId"] = playerId;

          console.log("default", global_config);

          FBInstant.player.getConnectedPlayersAsync()
            .then(function (players) {
              console.log("getConnectedPlayersAsync", players);
            }).catch(err => {
              console.error("getConnectedPlayersAsync", err);
            });
        });
  });
}

The game is currently in development mode. I invited a few friends to test. The friends have authorized the game, but calling FBInstant.player.getConnectedPlayersAsync() api keeps returning empty.

I want to know where is the problem and how to solve it

Found the reason, user_friends permissions need to be audited

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM