Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

about percentComplete in GKAchievement

After testing, I find that though the type of percentComplete of GKAchievement is double, and in apple's help document the legal values is between 0.0 and 100.0. but if you report percentComplete=1.5 to apple server, next time you will get the value percentComplete=1.0(another example, report 0.5, get 0.0). So I just think this may be a bug of percentComplete. Now our project has some achievements need be accumulated, like finish 200 times of play, we
don't save the value in local, but report current counted times to apple server, for next time's calculation.

I just tested in SandBox with iOS 4.2, I don't know whether it only occurs in SandBox, so does anybody also find this problem, what's your workround?

like image 428
Karl Yu Avatar asked Aug 20 '11 12:08

Karl Yu


1 Answers

Answer from Apple: "The percentages are reported using doubles but stored as whole number percentages, e.g. 1%, 2%, 3%, ..., 100%.
You should probably store the progress locally anyways, since they might be someplace they can't connect to Game Center."

For those with access to Apple dev forums: https://devforums.apple.com/message/522769

like image 156
SolidSun Avatar answered Sep 21 '22 00:09

SolidSun