【问题标题】:iPhone GameKit: Communication with Sandbox - GKErrorDomain Code 3iPhone GameKit:与沙盒通信 - GKErrorDomain 代码 3
【发布时间】:2010-10-13 06:39:57
【问题描述】:

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

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 connect 上创建名为“标准”的排行榜
  • 我可以在模拟器中浏览网页

这是我用来上传乐谱的代码

    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");
         }
     }];

【问题讨论】:

  • 这几乎是来自 Apple 文档的分数。我已经成功地使用了它。我发现,与 GameCenter 通信时出现的错误通常是由服务器端的问题引起的。突然事情停止了,几个小时后,一切又好了。
  • 我意识到 initWithCategory 参数应该采用完全限定名称,例如 com.companyName.productName.leaderboard 或 com.companyName.leaderboard ...但仍然是 GKErrorDomain Code=3

标签: iphone app-store-connect gamekit


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    NSLog(@"An error occured reporting the score: %@", error);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-29
      • 2013-04-15
      • 1970-01-01
      • 1970-01-01
      • 2016-09-14
      • 2011-06-20
      相关资源
      最近更新 更多