iPhone GameKit:与沙盒通信 - GKErrorDomain 代码 3
有人有过 GameKit GKErrorDomain Code 3 的经验吗?当我尝试将分数上传到沙盒中的排行榜时,我收到错误消息。 iOS 参考库只是说指示与游戏中心通信时发生错误
这里是完整的错误消息:
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 发出的,已验证本地玩家谁已登录沙盒
- 名称为“Standard”的排行榜已在 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");
}
}];
Anyone has any experience with GameKit GKErrorDomain Code 3? I receive the error message when I try to upload a score to a leaderboard in the Sandbox. The iOS reference library just says that Indicates that an error occurred when communicating with Game Centre
The 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
The environment:
- The request is being made from the 4.1 Simulator
- GameKit has authenticated the local player who has logged into the Sandbox
- The leaderboard with the name "Standard" has been created on iTunes connect
- I can browse the web in the simulator
Here is the code I use to upload the score
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");
}
}];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GKDomainError Code 3 的原因之一(也是影响我的原因)是初始化 GKScore 时 initWithCategory 消息中指定的排行榜类别 ID 指定不正确。
One reason (which is the reason that was affecting me) for GKDomainError Code 3 is if the Leaderboard Category Id specified in the initWithCategory message when initializing GKScore is incorrectly specified.
如果打印出错误,就更容易追踪。
ETC:
It's easier to track down if you print out the error.
Etc: