views:

284

answers:

1

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?

A: 

Exact same problem here. It worked about 1 out of 5 times for me yesterday morning. Today I haven't been able to login to Game Center sandbox even once (using the same code you posted).

edit: I changed the deployment target to 3.0 "Project - Edit Active Target - iOS Deployment Target"

Then I was able to select 4.1 simulator for my active executable and I can login and everything works. Something with the 4.2 sandbox I guess...

Steve Mulligan
I think it was basically Game Center itself that wasn't working. As of yesterday everything works as expected.
Joseph Tura