The release notes for the latest daily build says that the loadAchievements request is now returning data. I can’t seem to get any response from it. When I call it, nothing happens. I have tried putting alerts and print statements into the callback, and nothing happens. It seems like it isn’t functional. Has anyone been able to use the loadAchievements? I don’t know what to try next. [import]uid: 108813 topic_id: 20775 reply_id: 320775[/import]
Anyone? Ansca? [import]uid: 108813 topic_id: 20775 reply_id: 81920[/import]
bueller ? bueller?
raising this
c [import]uid: 24 topic_id: 20775 reply_id: 82038[/import]
So to be clear, in your callback listener, you’re not receiving anything in event.data?
Are you receiving anything in event.data with other requests? [import]uid: 52430 topic_id: 20775 reply_id: 82046[/import]
Make sure you are using build 730 or later.
Also make sure you have completed achievements. I think it only returns information for achievements that the user has actually progressed in. There is a different API to get all the achievements regardless of status.
[import]uid: 7563 topic_id: 20775 reply_id: 82047[/import]
Yes, every other request I am receiving event data. unlocking achievements, setting high score, load local player. They all return event data. [import]uid: 108813 topic_id: 20775 reply_id: 82048[/import]
I have multiple achievements unlocked. I also tried just putting a generic alert in the call back, so if there is no data it should pop up anyways. The alert doesnt show up. [import]uid: 108813 topic_id: 20775 reply_id: 82051[/import]
I am using 730 [import]uid: 108813 topic_id: 20775 reply_id: 82052[/import]
I went back and tested this. It’s working for me. I’m not sure what to tell you.
In my test code (against Apple’s GKTapper), I set some achievements:
gameNetwork.request( "unlockAchievement",
{
achievement =
{
identifier="com.appledts.twenty\_taps",
percentComplete=100,
showsCompletionBanner=true,
},
listener=requestCallback,
}
)
gameNetwork.request( "unlockAchievement",
{
achievement =
{
identifier="com.appledts.one\_hundred\_taps",
percentComplete=20,
showsCompletionBanner=true,
},
listener=requestCallback,
}
)
Then later, I call:
gameNetwork.request( "loadAchievements", requestCallback )
My callback:
function requestCallback( event )
print("requestCallback")
for k,v in pairs(event) do
print("k, v ", k, v)
end
if event.data and type(event.data) == "table" then
for k,v in pairs(event.data) do
if type(v) == "table" then
for k2, v2 in pairs(v) do
print("k2, v2 ", k2, v2)
end
else
print("k, v ", k, v)
end
end
print("\n")
end
end
My output:
requestCallback
k, v provider gamecenter
k, v type loadAchievements
k, v name gameNetwork
k, v data table: 0x5de240
k2, v2 isCompleted false
k2, v2 identifier com.appledts.one\_hundred\_taps
k2, v2 isHidden false
k2, v2 showsCompletionBanner false
k2, v2 percentComplete 20
k2, v2 lastReportedDate Monday, January 23, 2012 6:02:56 PM Pacific Standard Time
k2, v2 isCompleted true
k2, v2 identifier com.appledts.twenty\_taps
k2, v2 isHidden false
k2, v2 showsCompletionBanner false
k2, v2 percentComplete 100
k2, v2 lastReportedDate Monday, January 23, 2012 6:02:56 PM Pacific Standard Time
[import]uid: 7563 topic_id: 20775 reply_id: 82063[/import]
Well that solves the problem. The official documentation found at :
http://developer.anscamobile.com/reference/index/game-network/gamenetworkrequest
show the syntax to be :
gameNetwork.request( "loadAchievements", { listener=requestCallback } )
That does not work. The way that you called it does work :
gameNetwork.request( "loadAchievements", requestCallback )
There seems to be inconsistencies in the API. Other requests such as :
gameNetwork.request( "loadLocalPlayer", { listener=requestCallback } )
do work with the “listener”.
Thanks for your help. Also, make sure to check out Meowch! Soon to have game center support!
http://developer.anscamobile.com/showcase/meowch
We don’t want those promo codes we provided to go to waste! [import]uid: 108813 topic_id: 20775 reply_id: 82069[/import]
Ah, that’s a bug. It should be a table parameter for consistency.
[import]uid: 7563 topic_id: 20775 reply_id: 82070[/import]
I just pushed in a change that fixes this plus a few other APIs that had the same problem. (resetAchievements, init). Please let us know if there are any others in Game Center that need fixing.
[import]uid: 7563 topic_id: 20775 reply_id: 82078[/import]
Hey, can anybody help me?
My event.data is always returning a empty string…
My code:
local function requestCallbackAchievements( event )
\_G.TempVar = event.data[1].identifier --For exemple
end
local function GCLoadAchievements()
gameNetwork.request( "loadAchievements", { listener=requestCallbackAchievements })
end
And I make this test at a button os screen:
native.showAlert("Test", \_G.TempVar, {"OK"})
It ALWAYS is returning a empty string, doesn’t matter with id or property (identifier, isCompleted, etc) of event.data I use.
Does anyone know???
Thanks [import]uid: 94630 topic_id: 20775 reply_id: 84086[/import]
loadAchievements only returns achievements that the user has (partially) completed. Apple seems to return nil otherwise. I’ve also seen network lag issues where I set an achievement but if I load it back immediately, sometimes it doesn’t appear. (I wait a few seconds.)
[import]uid: 7563 topic_id: 20775 reply_id: 84090[/import]
Got it…
I thought it returned all the achievements, including the not completed.
Thanks for the help!!! [import]uid: 94630 topic_id: 20775 reply_id: 84093[/import]
The resetAchievements does not seem to work for me. I’m using the latest daily build. Does anyone have the same problem? Is it on Corona or Apple side?
The resetAchievements does not seem to work for me. I’m using the latest daily build. Does anyone have the same problem? Is it on Corona or Apple side?