0

我已经Game Center在我的 iTunes 中为我的应用程序启用了连接。在我的游戏中心,我创建了一个名为“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 分钟前创建了排行榜,苹果还没有启用它吗?如果否则,我不知道我做错了什么。

这是我的错误:

错误:错误域 = GKErrorDomain 代码 = 6 “请求的操作无法完成,因为本地播放器尚未经过身份验证。” UserInfo=0x1ed4d4a0 {NSLocalizedDescription=请求的操作无法完成,因为本地播放器尚未通过身份验证。}

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

4

1 回答 1

0

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

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.
         }
     }];
}
于 2012-09-27T11:57:04.057 回答