Bug or something else (Corona - Apple and viceversa)

Hi guys…

I am not an expert, but I may have found a bug, or better say imperfection regarding how Corona handles Apple Game Center.

So what happened in last two days.

I was preparing my game for release, but I was unsatisfied how I manage Apple Game Centre achievements.

I was doing something like this:

local achievement10unlocked = false local function requestCallback(event) if event.errorCode then -- show native error alert else -- set a flag that achievement is unlocked so never unlock it again (while app is installed) achievement10unlocked = true print(event.data.identifier)      print(event.data.isCompleted) end end if((score \> 10) and (achievement10unlocked == false)) then gameNetwork.request( "unlockAchievement", { achievement = { identifier = "com.blabla.ten", percentComplete = 100, showsCompletionBanner = true }, listener = requestCallback } ) end

Everything was fine, achievement10 was unlocked and that could be seen in Apple Game Center window (I got a message OK).

I tested my app, and xCode console showed  isCompleted = true for that particular achievement (while requestCallback function was executed).

So I said to myself, if user deletes your app and re-installs it, you will again send request to unlock that particular achievement (achievement10) to the Apple servers (and Apple guys may get mad during app review process).

So why not load achievements like showed in Corona Docs.

So I loaded my achievments like this:

local function loadAchievementsrequestCallback (event)   if(event.data) then       print(event.data.identifier)       print(event.data.isCompleted) end gameNetwork.request( "loadAchievements", { listener=loadAchievementsrequestCallback } )

And I constantly recieved nil when doing print(event.data.isCompleted) line.

So I changed and changed my code, changed user sandbox tester, unlocked achievement all over again… nothing helped.

Always nil despite that particular achievement was unlocked on Apple GC servers.

I was frustrated, so I inserted into  loadAchievementsrequestCallback function just below print(event.data.isCompleted) line following function:

https://coronalabs.com/blog/2014/09/02/tutorial-printing-table-contents/

I basically do this:

print\_r(event.data)

MY POINT!

xCode console showed during testing there is no “is.Completed” boolean parameter on Apple GC.

You get in xCode console:

table: 0x163ad9430

[isHidden] => false

[unachievedDescription] => “Something here”

[identifier]  => “com.xxx.xxx”

[archivedDescription] => “Something here”

isCompleted is never returned when you loadAchievements.

MY QUESTION

Can I submit my app in a way that I always send request to unlockAchievement no matter isCompleted boolean parameter is true or false?

Will Apple get mad?

Many thanks!

Ivan

Why not keep track yourself if you’ve sent it? I doubt this is a rejectable item.

Rob

I can keep track. I was just trying to cover eventual uninstall/install option.
Thanks Rob.

I don’t think this is something that Apple would monitor at all, unless you were excessive (sending the requests every frame or something). Even then I suspect that all that would happen is that you’d hit a threshold and requests would start being ignored.  

Remember that achievements already have a “percentComplete”, so multiple requests for a given achievement are already allowed by Apple.

Thanks Alan.

Why not keep track yourself if you’ve sent it? I doubt this is a rejectable item.

Rob

I can keep track. I was just trying to cover eventual uninstall/install option.
Thanks Rob.

I don’t think this is something that Apple would monitor at all, unless you were excessive (sending the requests every frame or something). Even then I suspect that all that would happen is that you’d hit a threshold and requests would start being ignored.  

Remember that achievements already have a “percentComplete”, so multiple requests for a given achievement are already allowed by Apple.

Thanks Alan.