iPhone GameKit: Communication with Sandbox - GKErrorDomain Code 3
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");
}
}];
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.
It's easier to track down if you print out the error. Etc:
NSLog(@"An error occured reporting the score: %@", error);
精彩评论