I am trying to get a gamecenter leaderboard to work, but have gotten stuck. I am testing on the Xcode simulator because I was having trouble logging in to our sandbox account on a device. I am able to login to the sandbox account through the game using the init function, but the leaderboard does not show up in gamecenter. Under games it shows our game but underneath it says “No leaderboards or achievements”. I have set up a leaderboad in itunes connect, and have requests to setHighScore in the code that seem to be working. Here is the relevant code:
local function updateCallback(e) local data = json.encode( e.data ) -- show encoded json string via native alert native.showAlert( "e.data", data, { "OK" } ) end --[[Update the gamecenter learderboard for gamescore.]]-- function [app name]GameNetwork.updateGamescore() --Sets the score if it is higher than the one on Apple's server gameNetwork.request( "setHighScore", { localPlayerScore = { category = "com.[domain].[game].gamescore", value = gamescore }, listener = updateCallback }) end
As expected the update callback displays {“value”: 25,“category”:“com.[domain].[game].gamescore”} when the updateGamescore function is called. Am I missing something? Any good tutorials on the gamenetwork api?