I am trying to authenticate a GKLocalPlayer with Game Center. However, the code supplied by Apple
- (void) authenticateLocalPlayer
{
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
if (error == nil)
{
// Insert code here to handle a successful authentication.
NSLog(@"Logged in.");
}
else
{
// Your application can process the error parameter to report the error to the player.
NSLog(@"%@", [error description]);
}
}];
}
does not seem to do the trick for me. I always get an alert "Could not connect to Game Center server." with the option to "Retry" or "Cancel". Neither of the NSLog statements is executed, so I guess that the completionHandler is not even fired.
If I press retry, I get the following error:
Error Domain=GKErrorDomain Code=7 "The requested operation could not be completed because local player is already authenticating." UserInfo=0x8915f80 {NSLocalizedDescription=The requested operation could not be completed because local player is already authenticating.}
Anyone have any idea what is going wrong?
One possible problem I found with connecting to Game Center is that your date may be wrong on the device. Check if your date is the actual current date. Somehow Game Center does not allow connections from devices with incorrect dates.