任何人有使用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
环境:
以下是我用来上传分数的代码
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");
}
}];
答案 0 :(得分:2)
GKDomainError Code 3的一个原因(这是影响我的原因)是在初始化GKScore时在initWithCategory消息中指定的排行榜类别ID未正确指定。
答案 1 :(得分:0)
如果您打印出错误,则更容易追踪。 等等:
NSLog(@"An error occured reporting the score: %@", error);