- 1 for not working for me either.
Noob question, can someone tell me what
[lua]listener=requestCallback[/lua]
means? [import]uid: 123298 topic_id: 25565 reply_id: 107669[/import]
Noob question, can someone tell me what
[lua]listener=requestCallback[/lua]
means? [import]uid: 123298 topic_id: 25565 reply_id: 107669[/import]
@Axie Studios
the listener (optional) will be called after the request to the gamenetwork returns.
you can use it to catch the different events.
see the API reference what data is returned.
There are also a couple of forum threads with sample code.
[import]uid: 123200 topic_id: 25565 reply_id: 107691[/import]
@Axie Studios
Just to be sure, you do have to have a subscription because the GameCenter is not supported in the current latest stable build. You need a daily build, I think 735 or later.
Not that my leaderboards seem to work at the moment (running 819). [import]uid: 123200 topic_id: 25565 reply_id: 107705[/import]
Yeah I have a subscription running 818. I’m able to get the test accounts in sandbox mode to send and receive friend requests and my game shows and the leaderboard shows up.
I just can’t seem to be able to post anything in the actual leaderboards. I’ve done a lot of searching and tried everything I could find.
Thanks for the help on my question though! [import]uid: 123298 topic_id: 25565 reply_id: 107713[/import]
Maybe you (as I) forgot to set leaderboards that you use into “view details”?


[import]uid: 131735 topic_id: 25565 reply_id: 107744[/import]
@lapamerinfo
Thanks for the reminder. I actually have this set since a couple of days now, but no luck in getting the scores to show up on the boards.
First I thought it might have been me forgetting the CFBundleIdentifier in the build.settings (thx gtartarkin) but that didn’t help either.
The app ID is made. The development profile is made and linked to the app ID. No. * in the name. The game network is enabled. 2 leaderboards with simple IDs are set (not full com.myname.myapp.leaderb-name but just leaderb-name) and enabled. In the app details 2 leaderboards are ready for submission. I’ve created a few test users in iTC. Logged out of tHe GC. Started the app, logged in using a test user, it shows that I’m working in the sandbox. Submitted a score (did it several times with increasing scores and using at least two test users). The GC response was my category and the value (both correct).
With or without waiting the leaderboards stay empty. I’ve used loadScores and show() to checked the boards (and using the GC app, logged in a test user (sand,box) and checked the boards from there) all empty.
I even tried reverting to an earlier daily build (772) that I used on a previous bit of code that did work.
That didn’t work either (figures).
I’m so hoping there’s a simple solution to this. Starting to doubt myself 
[import]uid: 123200 topic_id: 25565 reply_id: 107748[/import]
You have to use same name Leaderboard ID as you set at “Edit Leaderboard”.
See my exemple:
if gameCenterLogin==true then
gameNetwork.request("setHighScore", {
localPlayerScore={category="score1", value=ball},
listener=nil
})
end

Result you see after (6-12) hours. [import]uid: 131735 topic_id: 25565 reply_id: 107752[/import]
@lapamerinfo
Thanks for the suggestion!
Yes I have. Eg. I have a leaderboard called “Survival” and its ID is “survival”.
When I post a score I do:
local leaderbrd = "survival"
local score = 100
gameNetwork.request( "setHighScore", { localPlayerScore={ category=leaderbrd, value=tonumber(score) }, listener=requestCallback } )
I did the tonumber() just to be sure, although it should not be needed.
I even tried using fixed values in the call just to make sure the variables weren’t messed up. Like:
gameNetwork.request( "setHighScore", { localPlayerScore={ category="survival", value=100 }, listener=requestCallback } )
To no avail.
Still no scores visible.
[import]uid: 123200 topic_id: 25565 reply_id: 107755[/import]
I just tried build 725 (as that is the frist build that had the Game Center in it). Somehow it won’t work with the lastest Xcode simulator, so I just tested it on my device.
Although I still want to wait a few hours before complaining that the old build laso doesn’t work (anymore), I did see one difference between the latest daily build and 725.
The event data that came back from the GC had more information in build 725 than 819.
It returns:
{"provider":"gamecenter","type":"setHighScore","name":"GameNetwork",
"data":{"value":83,"date":"zondag 20 mei 2012 15:27:03 Midden-Europese
zomertijd","context":0,"category":"survival"}}
The info in the 819 build does not return the “date” nor the “context”.
[import]uid: 123200 topic_id: 25565 reply_id: 107756[/import]
@lapamerinfo thanks for that! I hadn’t had that stuff checked yet. Still scores aren’t showing up maybe ganna wait a while to check again.
@dutchottie Please keep us posted with hat happens with the older build. [import]uid: 123298 topic_id: 25565 reply_id: 107760[/import]
So I have this app that’s already for sale but without GC.
I was implementing it a couple of weeks ago and it worked.
So I took my sample code (see: https://developer.anscamobile.com/forum/2012/05/19/game-center-not-showing-scores-driving-me-nuts) changed the build.settings to the correct Identifier, changed the leaderboard name in the code (in this case to “Classic”) and ran the sample app in the Xcode Simulator. Using build 819.
Lo and behold, it works. I see my previous test scores and when I add a score it’s visible within seconds. Both using loadScore() and show() requests.
Also the GC is not turned on on the View Details of the App (iTC), just under Manage Game Center there’s 1 leaderboard active.
Okay, so the GC works (duh), the sample code works, it has to be the iTunes Connect settings. What else?
So I created a test application (made ID, development cert, etc) with 1 leaderboard and the same settings as in my old app.
No luck. Can’t get the highscores posted.
The only difference now is that the old app is already in the App Store and my new app and the testing app are both waiting for upload for the first time.
This seems to suggest you need an active game to test the GC??? Hope not.
[import]uid: 123200 topic_id: 25565 reply_id: 107761[/import]
Try to set Achivements, you can see them more faster then Leaderboards. I don’t know why but I see a achivement at once when I send dates.
P.S. I using build 791. [import]uid: 131735 topic_id: 25565 reply_id: 107763[/import]
@ lapamerinfo
Yeah you might be right that that will help. I’ll try.
On other web sites I’ve seen comments by other developers (not Corona) who are having similar problems.
It might be the sandbox server at Apple that are the problem.
[import]uid: 123200 topic_id: 25565 reply_id: 107764[/import]
Oh forgot. The 725 build didn’t help.
back to 819.
[import]uid: 123200 topic_id: 25565 reply_id: 107770[/import]
Could anyone please give this problem a try by making a test App in iTC, setting up a leaderboard and using a small test script to test posting and requesting highscores?
Ever so thankful!
[import]uid: 123200 topic_id: 25565 reply_id: 107842[/import]
Okay, I’ll give a quick summary hoping you guys/gals at Ansca take a look at this.
Problem?
setHighscore() does not result in visible high scores on the GC
What did I do?
First I have an app that’s live without GC. I’ve submitted this in March (build 772 I think).
Now I’ve enabled the GC (thus in Sandbox mode) and added 2 leaderboards and a few Achievements.
I’ve got a small test program (see code below) that logs in, gets the current user name, a button for gamenetwork.show() and a button to post using setHighscore() and an automatic loadScores() after the setHighscore() call.
Using a development cert for the app I build (using 819) the test program and start up the Xcode sim.
I log out of the GC. Then inside the test app log in using 1 of 3 test users (I tested all 3) and submit some scores. No problem. Scores appear immediately (remember the GC is in Sandbox mode as the GC support is not live yet).
Then I create a testApp in iTunes Connect using a test development profile and app ID. I only turn on the GC and create one leaderboard (I’ve tried 2 leaderboards and an achievement as well).
Then I build the test app again, now using the testApp ID and provisioning profile.
Log out of GC. Log into GC via the testApp.
The gamenetwork.show() works (using an other board name raise an error). The player is logged in correctly (I get the player data back).
Then I submit a few high scores (event reports my category and value correctly). The loadScores() call returns empty and the subsequent show() calls show No Scores. Even after hours or days waiting.
I’m at a loss. The code works. The settings in iTunes all seem exactly the same. One works, the other not. The only difference is that one app is live (without live GC support) and the other is Waiting for Upload.
Please anyone?!
Test App
[code]
local gameNetwork = require “gameNetwork”
local json = require “json”
io.output():setvbuf(“no”)
local loggedIntoGC = false
local function requestCallback( event )
if not (event.type == nil) then
local data = json.encode( event.data )
native.showAlert( “event.data”, data, { “OK” } )
end
if event.type == “loadLocalPlayer” then
currentPlayerName = event.data.alias
native.showAlert( “player name”, currentPlayerName, { “OK” } )
elseif event.type == “setHighScore” then
local function alertCompletion() gameNetwork.request( “loadScores”, { leaderboard={ category=“survival” }, listener=requestCallback } ); end
native.showAlert( “High Score Reported!”, “”, { “OK” }, alertCompletion )
elseif event.type == “loadScores” then
if event.data then
local topRankID = event.data[1].playerID
local topRankScore = event.data[1].formattedValue
local bestTextValue = string.sub( topRankScore, 1, 12 ) … “…”
print(topRankID … “-” … topRankScore … “-” … bestTextValue)
print(“Fetching players”)
if topRankID then gameNetwork.request( “loadPlayers”, { playerIDs={ topRankID }, listener=requestCallback} ); end
else
print(“No data from loadScores”)
end
native.showAlert( “loadScores”, topRankID, { “OK” } )
elseif event.type == “loadPlayers” then
if event.data then
local topRankAlias = event.data[1].alias
if topRankAlias then
native.showAlert( “Top rank”, topRankAlias, { “OK” } )
end
end
elseif event.type == “leaderboards” then
native.showAlert( “reqCB”, “Showing board”, { “OK” } )
end
return true
end
local function initCallback( event )
if event.data then
loggedIntoGC = true
gameNetwork.request( “loadLocalPlayer”, { listener=requestCallback } )
else
native.showAlert(“Log in GC failed!”, “”, {“OK”})
end
return true
end
local function setHighscore( event )
if event.phase == “ended” then
print(“setting highscore”)
local userScore = 10
if loggedIntoGC then gameNetwork.request( “setHighScore”, { localPlayerScore={ category=“survival”, value=userScore }, listener=requestCallback } ); end
end
end
local function showLeaderboard( event )
if event.phase == “ended” then
print(“showing leaderboard”)
gameNetwork.show( “leaderboards”, { leaderboard = { category=“survival” }, listener=requestCallback })
end
end
local btn = display.newRect(100,100,200,100)
btn:setFillColor(255)
btn:addEventListener(“touch”, setHighscore)
local showGC = display.newRect(100,300,200,100)
showGC:setFillColor(150)
showGC:addEventListener(“touch”, showLeaderboard)
gameNetwork.init( “gamecenter”, initCallback ) --startGC() --Initializes the Game Center
[/code] [import]uid: 123200 topic_id: 25565 reply_id: 107885[/import]
How’s it coming dutch?
I checked tonight and my scores seem to be up and working ok, finally! Hopefully yours is also doing good. [import]uid: 123298 topic_id: 25565 reply_id: 108015[/import]
Thanks Axie.
Yes mine suddenly started working too!
I guess Apple did finally realize something was going wrong 
At least I know it wasn’t me, or you, or …
Thanks again for thinking along.
Have fun
[import]uid: 123200 topic_id: 25565 reply_id: 108020[/import]
Amazing! No code changes and mine are finally showing up too! Yay! [import]uid: 135199 topic_id: 25565 reply_id: 108029[/import]
My leaderboards are showing too…hopefully it will work now in Live mode too 
Thx! [import]uid: 89239 topic_id: 25565 reply_id: 108038[/import]