完成GKA的百分比 [英] about percentComplete in GKAchievement

查看:67
本文介绍了完成GKA的百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过测试,我发现尽管GKAchievement的percentComplete类型为double,并且在Apple的帮助文档中合法值在0.0到100.0之间.但是如果您向Apple服务器报告percentComplete = 1.5,则下次您将获得值percentComplete = 1.0(另一个示例,报告0.5,得到0.0).所以我只是认为这可能是percentComplete的错误. 现在我们的项目需要积累一些成就,例如完成200次游戏,我们
不要将值保存在本地,而是将当前的计数时间报告给Apple服务器,以进行下一次计算.

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.

我刚刚在Sandbox上使用iOS 4.2进行了测试,不知道它是否仅在SandBox中发生,所以有人还会发现此问题吗?

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?

推荐答案

Apple的答案: 百分比是使用双精度数据报告的,但以整数百分比存储,例如1%,2%,3%,...,100%.
无论如何,您可能应该将进度存储在本地,因为它们可能在某个无法连接到Game Center的地方."

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."

针对有权访问Apple开发人员论坛的人: https://devforums. apple.com/message/522769

这篇关于完成GKA的百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆