Here is my situation:
1) The user first opens my application. I immediately call authenticateLocalUser to try to register them with Game Center. A pop-up window with the "Login", "Create an account" and "Cancel" buttons will appear successfully.
2) The user does not want to register right now, so click "Cancel." (This is not the third time they clicked “cancel,” and I DO NOT accept “Game Center is disabled, log in to the Game Center application to enable it.”) The user can continue to use my application as usual.
3) The user wants to use the Game Center later, so they press the button that I gave them to enter the Game Center. I call authenticateLocalUser again. This time the popup is NOT displayed. Nothing actually happens, except that I get these console log messages:
2012-04-26 08:38:42.861 Clink[332:707] authenticateWithCompletionHandler: enter 2012-04-26 08:38:42.863 Clink[332:707] authenticateWithCompletionHandler: exit
4) I tested both immediately pressing a button that again calls authenticateLocalUser, and waiting for a significant period of time before that. At any time when I call authenticateLocalUser again, nothing appears again, and I get this error from the function:
Error Domain=GKErrorDomain Code=7 "The requested operation could not be completed because local player is already authenticating."
So what happens is that when I call authenticateLocalUser in step 3, I ask Game Center to authenticate, but it freezes and does not respond to my request. Then in step 4, when I try again, he informs me that he cannot process my request because he is already trying to authenticate. However, I waited up to 10 minutes for a response from my request in step 3, and I never received it from Game Center.
This is the content of my authenticateLocalUser function. As far as I remember, I did not change it from the version that I downloaded from the Apple code sample.
- (void) authenticateLocalUser { if([GKLocalPlayer localPlayer].authenticated == NO) { [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { [self callDelegateOnMainThread: @selector(processGameCenterAuth:) withArg: NULL error: error]; }]; } }
Has anyone else encountered this problem before or had any ideas on what could be happening? I looked at this for a while, and I'm not quite sure what is going on.
Thanks in advance!
ios objective-c gamekit game-center
Wendikidd
source share