Game Center HELP

Hi guys,

It’s been 3 weeks now since I’m submitting updates to Apple and I can’t seem to make GC stand alone to work.

I have tested Game Center in sandbox and it was submitting the highscore for my game.

Now, I downloaded the new version which just got approved and played the game. It’s asking my if I want to submit the highscore as it should, I press “yes” but nothing. The leaderboard is EMPTY!!!

Please, someone help me! What am I doing wrong??? Is this a bug maybe?

Thanks!
[import]uid: 89239 topic_id: 25565 reply_id: 325565[/import]

Are you still logged into your sandbox account?
[import]uid: 19626 topic_id: 25565 reply_id: 103322[/import]

Of course not :slight_smile: and I can’t see other players too…
Help! [import]uid: 89239 topic_id: 25565 reply_id: 103356[/import]

Help please!!! [import]uid: 89239 topic_id: 25565 reply_id: 104232[/import]

Here is an example of the code I used to post the score to Game Center:

local game\_network = require "gameNetwork"  
-------  
function game\_center\_init\_callback(event)  
 if event.data then  
 --print("gc logged in")  
 gc\_ok = true  
 else  
 --print("gc not logged in")  
 gc\_ok = false  
 end  
end  
--------  
function game\_center\_event(event)  
 if event.type == "applicationStart" then  
 game\_network.init("gamecenter",game\_center\_init\_callback)  
 return true  
 end  
end  
--------  
if gc\_ok == true then  
 local h = function(event)  
 if event.action == "clicked" and event.index == 2 then  
 local h = function(event)  
 --[[if event.data then  
 native.showAlert("Score posted","",{"OK"})  
 else  
 native.showAlert("Score not posted","",{"OK"})  
 end]]--  
 end  
  
 game\_network.request("setHighScore",{localPlayerScore={category="LeaderBoardName",value=score},listener=h})  
 end  
 end  
  
 native.showAlert("Submit high score","Would you like to submit the new high score?",{"No","Yes"},h)  
 end  

In the build settings I used:

CFBundleIdentifier = "co.uk.fanstudio.GameName", [import]uid: 89239 topic_id: 25565 reply_id: 104654[/import]

Anyone can help me with this problem?

Anyone having the same problem???

Thank you! [import]uid: 89239 topic_id: 25565 reply_id: 105712[/import]

I have same problem. When I tested my game as sandbox all my dates saved in GameCenter.

Now Apple updated my game in AppStore. The leaderboard is empty and when I play not sandbox or as sandbox dates NOT SAVE!

What I have to do??? [import]uid: 131735 topic_id: 25565 reply_id: 107022[/import]

Seems like this is to blame: https://devforums.apple.com/thread/129787?tstart=0 [import]uid: 84637 topic_id: 25565 reply_id: 107080[/import]

Thank you. The test worked good. My app has been approved 14 may. 3 gamers (all not developer) play this game and their result has to sent in GameCenter. But leaderboard and achivements are empty! [import]uid: 131735 topic_id: 25565 reply_id: 107101[/import]

I also have problems with open feint and gamecenter now after i altered my code to use the new game network setp. Dosent post score anymore. Open feint starts up and game center recognise the game and that you are playing but no score gets posted :frowning: need to go over and see what I am missing… But just cant find anything wrong. [import]uid: 17969 topic_id: 25565 reply_id: 107104[/import]

It’s a month now since I’m having this issue, this is so FRUSTRATING and never heard back from ANSCA. I also submitted a bug report but nothing yet.

There is something wrong for sure but I can’t figure out what… [import]uid: 89239 topic_id: 25565 reply_id: 107255[/import]

Hi office83,
I think my problem is GameCenter bug.
I have created 2 Leaderboards and 10 Achievements in “Manage Game Center” and tested them.

After approved my app, I see in “View Details” (Versions) GameCenter is “enabled” but Leaderboards and Achievements are 0 Submited.

Maybe you have same problem?

I have send the letter to Apple support. I’ll wait their answer. [import]uid: 131735 topic_id: 25565 reply_id: 107265[/import]

The leaderboards are empty looks like the score is not posted… [import]uid: 89239 topic_id: 25565 reply_id: 107288[/import]

I’ve been having this exact same problem. Nothing is showing up in Leaderboards, but I do get achievements posting. I’ve tested with multiple user accounts in the Game Center sandbox with no luck. I did switch out to using OpenFeint and got the leaderboard scores showing up there, but still nothing in Game Center after configuring my OFGameCenter.plist file so that it would post to both.

By the way, anyone know if you can hide the annoying “new high score” popups anytime you post a score to OpenFeint? [import]uid: 135199 topic_id: 25565 reply_id: 107442[/import]

 local function requestCallback(event)  
 if event.errorCode then  
 native.showAlert("Error", event.errorMessage, { "Ok"})  
 else  
 lbData = event.data  
 local playerIDs = {}  
 for i = 1, #lbData do  
 print(lbData[i].formattedValue)  
 print(lbData[i].playerID)  
 print(lbData[i].rank)  
 playerIDs[i] = lbData[i].playerID  
 end  
 end  
 end  
  
gameNetwork.request( "loadScores", { leaderboard={ playerScope="Global", timeScope="AllTime", range={1,5} }, listener=requestCallback } )  

Adapt this code to your program after you set the score and see what it returns. If you get data, its working and you have some login/cache issues. If you get back no data then you are having problems setting the data.
[import]uid: 19626 topic_id: 25565 reply_id: 107595[/import]

Thanks robmiracle, I’ll give that a try. Is there any way to use the print statements on an actual device, or should I change those into some sort of native alert since game network calls don’t work in the simulator? [import]uid: 135199 topic_id: 25565 reply_id: 107600[/import]

using a sync/charging cord plug it into your mac and using XCode’s Organizer watch the console log.

[import]uid: 19626 topic_id: 25565 reply_id: 107608[/import]

That’s a good tip I never though of to see the output. It doesn’t always seem to print though, so I did start using native alerts with json.

Here’s the result from my post, which as far as I can tell seems successful:

{“provider”:“gamecenter”,“type”:“setHighScore”,“name”:“gameNetwork”,“data”:{“value”:41,“category”:“shipsLaunched”}}

Unfortunately when I do the loadScores call event.data is nil:

{“provider”:“gamecenter”,“type”:“loadScores”,“name”:“gameNetwork”}

On the iTunes Connect side, I’ve triple-checked that my leaderboard ID is shipsLaunched. My achievements are posting just fine, so I’m really quite lost here. I’ve even narrowed this down to a super-simple main.lua file that just logs me in, waits a few seconds, then posts a score and tries to load the scores. I’ve tried changing the leaderboard that I load, and if I do something other than shipsLaunched, it complains about a bad value, but I switch it back to shipsLaunched and just get the results above.
Here’s what I’m trying. I’ve run this with both of my two test user accounts from iTunes Connect in sandbox mode on my device.
[lua]local json = require “json”
gameNetwork = require “gameNetwork”
loggedIntoGC = false

local function initCallback(event)
if event.data then
loggedIntoGC = true
print(“Logged into Game Center”)
else
print(“Failed to log in to Game Center”)
end
end

function onSystemEvent(event)
if “applicationStart” == event.type then
loggedIntoGC = false
gameNetwork.init(“gamecenter”, { listener=initCallback })
return true
end
end

local function postScoreCallback(event)
print(“postScoreCallback”)
local data = json.encode(event)
native.showAlert(“postScoreCallback”, data, {“OK”})
end

local function postScore()
print(“postScore”)
gameNetwork.request(“setHighScore”, {
localPlayerScore = {
category=“shipsLaunched”,
value=10
},
listener = postScoreCallback
})
end

local function requestScoreCallback(event)
print(“requestScoreCallback”)
local data = json.encode(event)
native.showAlert(“requestScoreCallback”, data, {“OK”})
end

local function checkScore()
print(“checkScore”)
gameNetwork.request(“loadScores”, {
leaderboard = {
category = “shipsLaunched”,
playerScope = “Global”,
timeScope = “AllTime”,
range = {1,2}
},
listener=requestScoreCallback
})
end

Runtime:addEventListener(“system”, onSystemEvent)

timer.performWithDelay(10000, function()
postScore()
checkScore()
end
)[/lua]

[import]uid: 135199 topic_id: 25565 reply_id: 107622[/import]

Hi Mark,

I’m running into exactly the same problems (just post a new thread: https://developer.anscamobile.com/forum/2012/05/19/game-center-not-showing-scores-driving-me-nuts)
Very frustrating. I had it working on my last app, but now…
I do get data back from the setHighscore request. It reports the value and the category I submitted, so that seems in order. Just no data on the leaderboard.

Curious if others can come up with a trick to solve this one.
[import]uid: 123200 topic_id: 25565 reply_id: 107633[/import]

Same here, archivements works fine but no leaderboard. [import]uid: 12704 topic_id: 25565 reply_id: 107656[/import]