I’m finding my self needing synchronous but what we have is asynchronous… and I’m not seeing a smooth way to “wait” for, let’s say, a “loadScores” request from GC. Am I looking at a timer within some sort of state management here, or is there a simpler way? Do I need to pay attention to a possible “endless” wait if there are server issues? Any GC help would be appreciated!
thanx! [import]uid: 21331 topic_id: 24195 reply_id: 324195[/import]
OK… that may have been too tall an order… LOL!
About “setHighScores” request:
- Can you just fire the score off without checking if it is high enough?
- Does the return (callback) from this request provide information as to the placement of the score submitted?
Also, I was able to attempt connection with my current code. I have set up Leaderboards at Apple for version 1.1 of my app. When presented with the login, it stated *****Sandbox****, which looked good. After putting in my apple credentials, it stated that it did not recognize the game. And now, further attempts to log in produce no log in form at all!?!
I could really use a few tips here to help speed things up. [import]uid: 21331 topic_id: 24195 reply_id: 97785[/import]
Well, you could make it “synchronous” if you want - just turn on the activity indicator until the callback event is dispatched xD
Async doesn’t make anything slower though, it just means you’re free to do anything else while you wait, so you’re not any better off stopping everything else (except, of course, making a bunch of other network requests at the same time).
What information are you trying to get back from GameCenter right after submitting the score? If you want to check if it’s a new personal high score, you’re best off saving all the scores locally and then compare them app-side.
-
Yes, it’ll only store higher scores (or vice versa if you have it set up that way)
-
I don’t think so, it would be handy but the leaderboards themselves aren’t necessarily updated immediately so I’m not sure this would even be possible. You can print out the key/values of the event to see what it has, I haven’t seen any specifics on this in the docs. I think it only tells you whether it was successful or not. [import]uid: 87138 topic_id: 24195 reply_id: 97799[/import]
OK. The way to solve this was, use another device, log in to GC, log out.
Other methods may work, but this worked for me.
Now I am getting Game Center account services are currently unavailable. Please try again later… anyone experience this one?
EDIT: This went away finally. I will continue any pertinent info in this thread in hopes of helping others…
[import]uid: 21331 topic_id: 24195 reply_id: 97808[/import]
Hey, thanks Revaerie.
I really appreciate that you always seem to be the one to jump in and give me a nudge when I’m in unexplored territory, your awsome!
I have been able to deduce a solid set of logic to handle the general “handling” of the topic, but the hits just keep com’in. LOL.
I don’t think async will make slower, just synchronous would make it easier. 
I will, however, need to look up this Activity Indicator you speak of…
I did end up doing what you are saying here and kept my existing in-game high-score system, attempt to grab the last 10 from GC to give them a “Congratz” message, and simply throw the high score up to GC.
The main problem I’m having now, is I accidentally used my main GC credentials to log into the Sandbox which I’m reading now, appears to be a big no-no.
Now I’m trying to figure out how to “reset”, and when it asks me to log into GC, make a new “test account”, and probably finish up… Any help here would be greatly appreciated! hahaha… one mistake, pay for hours!!! I was right there too…just HAD to pick “use existing account, didn’t I”! lol!
[import]uid: 21331 topic_id: 24195 reply_id: 97806[/import]
Was able to create a new account. I used a different email address and all seemed to go well. I then quit and killed my game and restarted. Now it states that it does not recognize my game anymore…I have done this twice now. It appears to log me in right after I create a new account, but then, even after email verification, i cannot log back in… I am stuck here.
I think making the game was easier than this stuff! LOL!
Anyone who has went through this same madness? Do I need to activate for version 1.0 (as I am attempting to test, as yet not uploaded, version 1.1 in the sandbox)? [import]uid: 21331 topic_id: 24195 reply_id: 97818[/import]
Tony, make sure you kill your app, sign out completely from the GC app itself, and then try logging in with your sandbox-specific account again from your app. Sometimes it’s just a matter of messing around with it, as you’ve discovered. All the sandbox account stuff can be a bit of a nightmare, unfortunately :\
And afaik you shouldn’t need to do anything on iTC besides enabling Game Center for your game and setting up your leader boards/achievements. [import]uid: 87138 topic_id: 24195 reply_id: 97857[/import]
Issues was BundleID. Was using old AdHoc with, although fully qualified, wrong domain compared to initial release…
Now I am initializing, I get the quick GC “Welcome back” box at the top, but it never makes it back to my callback…
Any ideas?
A trimmed down version of my module…
gcLib = {}
local gameNetwork = require("gameNetwork")
function gcLib:NewGC(inGameProps)
local gcLib = {}
function gcInitCallback(event)
native.showAlert( "callback!", "hit callback", { "OK" } )
if(event.data)then
inGameProps.gcLoggedIn = true
native.showAlert( "Success!", "Logged into Game Center", { "OK" } )
print("GAME CENTER LOGGED IN")
else
inGameProps.gcLoggedIn = false
native.showAlert( "Fail", "Local High Scores will be used", { "OK" } )
print("GAME CENTER NOT LOGGED IN")
end
end
function gcLib:InitGameCenter()
native.showAlert( "Init!", "Attempting Game Center init", { "OK" } )
gameNetwork.init("gamecenter", gcInitCallback)
end
return gcLib
end
I actually had the callback as a table listener at first, but needed to start removing variables to find the issue… [import]uid: 21331 topic_id: 24195 reply_id: 98077[/import]
Oh. Scratch that, starting working…???
wonder why it does not hit either of the alerts in my callback, yet it hits the callback!!??
Its also hitting the Init twice, yet the only place I make the call is “applicationStart”… oh boy…
EDIT: Looks like in my frustrations I’m creating scope issues… Things are starting to look better. 
Although “applicationStart” gets called twice…is this normal? [import]uid: 21331 topic_id: 24195 reply_id: 98080[/import]
Don’t get caught by this one:
The category passed to GC setHighScore, loadScores, etc is the Leaderboard ID NOT the name!! [import]uid: 21331 topic_id: 24195 reply_id: 98376[/import]