4

有人对 GameKit GKErrorDomain Code 3 有任何经验吗?当我尝试将分数上传到沙盒中的排行榜时收到错误消息。iOS 参考库只是说Indicates that an error occurred when communicating with Game CentreThe Here is the full error message:

Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x75e4eb0 {NSUnderlyingError=0x7531e00 "The operation couldn’t be completed. status = 5053", NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server

环境:

  • 该请求是从 4.​​1 模拟器发出的
  • GameKit 已对登录沙盒的本地玩家进行身份验证
  • 名称为“标准”的排行榜已在 iTunes 连接上创建
  • 我可以在模拟器中浏览网页

这是我用来上传分数的代码

    GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:@"Standard"] autorelease];
    scoreReporter.value = 10;
    [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) 
     { 
    if (error != nil) 
         {
             // handle the reporting error
             NSLog(@"An error occured reporting the score");
         }
         else 
         {
             NSLog(@"The score was reported successfully");
         }
     }];
4

2 回答 2

2

GKDomainError Code 3 的一个原因(这是影响我的原因)是,如果在初始化 GKScore 时在 initWithCategory 消息中指定的排行榜类别 ID 指定不正确。

于 2010-10-14T03:03:28.293 回答
0

如果您打印出错误,则更容易追踪。ETC:

NSLog(@"An error occured reporting the score: %@", error);
于 2010-10-16T16:20:41.200 回答