Hi,
I’m getting crazy about this issue. Here is my code:
main.lua
gameNetwork = require “gameNetwork”
loggedIntoGC = false
local function initCallback( event )
if event.data then
loggedIntoGC = true
– native.showAlert( “Success!”, “User has logged into Game Center”, { “OK” } )
else
loggedIntoGC = false
gameNetwork.request( “loadScores”,
{ leaderboard={ category=“com.mycompany.mygame.myrankingid”,
playerScope=“Global”, timeScope=“AllTime”, range={1,50} },
listener=requestCallback } )
– native.showAlert( “Fail”, “User is not logged into Game Center”, { “OK” } )
end
end
– function to listen for system events
local function onSystemEvent( event )
if event.type == “applicationStart” then
gameNetwork.init( “gamecenter”, initCallback )
return true
end
end
Runtime:addEventListener( “system”, onSystemEvent )
Then just to test:
if loggedIntoGC then
gameNetwork.request( “setHighScore”,
{ localPlayerScore={ category=“com.mycompany.mygame.myrankingid”, value=t.text },
listener=requestCallback } );
end
if loggedIntoGC then
gameNetwork.request( “loadScores”,
{ leaderboard={ category=“com.mycompany.mygame.myrankingid”, playerScope=“Global”, timeScope=“AllTime”, range={1,50} },
listener=requestCallback } );
end
if loggedIntoGC then
gameNetwork.show( “leaderboards”,
{ leaderboard={ category=“com.mycompany.mygame.myrankingid”, timeScope=“AllTime” } } );
end
Trying example on device do nothing, just login game center user…
Any help, please?