Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticating GKLocalPlayer with Game Center

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?

like image 609
Joseph Tura Avatar asked Sep 18 '10 17:09

Joseph Tura


People also ask

How do I find my Game Center ID Iphone?

If you forgot this, contact Apple. Open your Settings Application then locate "Game Center" and tap on this. Your Game Center ID is your Apple ID.

How do I check my Game Center login?

To check if you are signed in to Game Center you should navigate to "Settings > Game Center", from this menu you can either create a Game Center profile, using an e-mail account of your choice, or log in to your existing account.

Is Game Center an Apple product?

Bring even more fun and connection to your games with Game Center, Apple's social gaming network. Game Center lets players build an identity and connect with friends across Apple platforms.


1 Answers

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.

like image 120
Joseph Tura Avatar answered Nov 08 '22 10:11

Joseph Tura