【问题标题】:issue submitting score to a leaderboard将分数提交到排行榜
【发布时间】:2012-09-27 20:12:06
【问题描述】:

我在我的 iTunes 连接中为我的应用启用了Game Center。 在我的游戏中心,我创建了一个名为“Level 1”的排行榜,其 id 为“level1”,整数。

在我的游戏中,我尝试提交这样的分数:

 NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc]init];

    GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:@"level1"] autorelease];

    int64_t score1 =scr;
    scoreReporter.value = score1;
    [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) { 
        if (error != nil) {
            NSLog(@"Submit failed");
        }
        else {
            NSLog(@"Score Submited");
        }
    }];

    [pool release];

但我得到一个提交失败;我在大约 30-40 分钟前创建了排行榜,苹果还没有启用它吗?否则,我不知道我做错了什么。

这是我的错误:

Error: Error Domain=GKErrorDomain Code=6 "请求的操作 无法完成,因为本地播放器尚未完成 已通过身份验证。” UserInfo=0x1ed4d4a0 {NSLocalizedDescription=The 请求的操作无法完成,因为本地播放器有 未通过身份验证。}

顺便说一句,我的 iPhone 可以上网,并且我的手机已连接到苹果帐户

【问题讨论】:

  • 你试过阅读错误吗?描述是什么?
  • @AdamSwinden 我已经更新了文字

标签: iphone


【解决方案1】:

没有在游戏中心验证,现在可以了!

来自Game Center Programming Guide的示例:

- (void) authenticateLocalPlayer
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    [localPlayer authenticateWithCompletionHandler:^(NSError *error) {
         if (localPlayer.isAuthenticated)
         {
             // Player was successfully authenticated.
             // Perform additional tasks for the authenticated player.
         }
     }];
}

【讨论】:

    猜你喜欢
    • 2016-08-14
    • 1970-01-01
    • 1970-01-01
    • 2018-07-18
    • 2019-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-22
    相关资源
    最近更新 更多