【问题标题】:Does Game Center score syncing work for sandbox accounts?Game Center 分数同步是否适用于沙盒帐户?
【发布时间】:2013-09-05 04:43:35
【问题描述】:

我正在为 iOS 6.0 进行开发并向 Game Center 提交分数。当我通过互联网连接提交乐谱时,一切正常。

当我关闭我的互联网连接并提交一个应该更新排行榜的分数时,完成处理程序被调用而没有任何错误。当我重新打开互联网连接时,我希望 GameKit 将分数转发到 Game Center 并更新排行榜。但它不会更新,即使在很长一段时间(1 小时以上)之后也不会更新。

在最初提交乐谱时对玩家进行身份验证,并在重新打开互联网连接时再次进行身份验证。

我错过了什么吗?它适用于沙盒帐户吗?我的分数提交代码如下:

- (void)submitScore:(int64_t)score category:(NSString*)category {

//1: Check if Game Center features are enabled

if (!_gcEnabled) {
    return;
}

//2: Create a GKScore object

GKScore* gkScore = [[GKScore alloc] initWithCategory:category];

//3: Set the score value

gkScore.value = score;

//4: Send the score to Game Center

[gkScore reportScoreWithCompletionHandler:^(NSError* error) {

    [self setLastError:error];

    BOOL success = (error == nil);

    if ([_delegate respondsToSelector:@selector(onScoresSubmitted:)]) {

        [_delegate onScoresSubmitted:success];
    }
}];

}

【问题讨论】:

    标签: ios game-center leaderboard


    【解决方案1】:

    似乎缓存的分数,即在没有互联网连接时提交给 Game Center 的分数,在互联网连接恢复时不会自动或立即发送到 Game Center。相反,它们会在下次报告分数时发送。

    似乎如果我已经缓存了排行榜类别 x 的分数,我必须提交一个特定于该类别的新分数。提交不同类别的分数不会清空类别 x 的缓存。

    【讨论】:

    • 当然,这可能只是使用沙盒帐户测试环境的游戏的行为。
    • 在 iTunes Connect 上,我为每个排行榜设置了最低分数 > 0。当我检测到网络可达时,我为每个排行榜提交一个 gkscore.value = 0 的 GKScore 对象。 Game Center 拒绝得分(应该如此),并且该排行榜的 GKScore 对象的本地缓存被清除并重新提交给 Game Center。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-15
    • 1970-01-01
    • 2018-09-18
    • 1970-01-01
    相关资源
    最近更新 更多