我有一个具有 5 种不同游戏模式的应用程序,其中 3 种具有整数分数,其中 2 种具有基于时间的分数(他们完成游戏的速度)。
如何设置我的reportScore:
方法,以便我在 iTunes Connect 中设置的排行榜(以最低到最高的时间格式显示最高分到百分之一秒)将以时间格式接收我的用户分数?
我想把它作为NSTimeInterval
.
Apple Docs 指定的方法只接受一个整数作为分数:
- (void) reportScore: (int64_t) score forCategory: (NSString*) category
{
GKScore *scoreReporter = [[GKScore alloc] initWithCategory:category];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
//handle the score to submit again later
}
}];
}
更新
我对此进行了一些研究,我知道您只能将分数发送到 Game Center 排行榜作为int64_t
. 那么如何格式化这个整数,以便我的排行榜将其格式化为百分之一秒的时间呢?
谢谢你的帮助!