8

Here's my situation:

1) The user opens my application for the first time. I immediately call authenticateLocalUser to try and log them into Game Center. The popup with the Login, Create Account, and Cancel buttons successfully appears.

2) The user doesn't want to log in right now, so they click Cancel. (This is NOT the 3rd time they've clicked 'cancel', and I am NOT receiving the 'Game center disabled, log in from the Game Center app to enable' message.) The user can continue to use my app as normal.

3) The user wants to use Game Center later on, so they click a button I have given them to log into the Game Center. I again call authenticateLocalUser. This time, the popup does NOT appear. In fact nothing happens, except that I receive 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 have tested both immediately pushing the button which calls authenticateLocalUser again, and also waiting a significant period of time before doing so. At whatever point I call authenticateLocalUser again, once again nothing appears, 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 appears to be happening is that, when I call authenticateLocalUser in Step 3, I am asking Game Center to authenticate but it is getting hung up and not responding to my request. Then in Step 4 when I try again, it tells me it cannot process my request because it is already trying to authenticate. However I have waited up to 10 minutes for a response from my request in Step 3, and I never get one from the Game Center.

This is the content of my authenticateLocalUser function. As far as I recall i haven't changed it from the version I downloaded from Apple's sample code.

- (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 have any ideas about what might be going on? I've been looking at this for a while and am not really sure what's happening.

Thanks in advance!!

WendiKidd
  • 4,333
  • 4
  • 33
  • 50
  • Please let me know if you got this issue fixed. I am facing the same issue. Thanks. – DancOfDeth May 04 '12 at 14:25
  • Newi, unfortunately I have not. I found a unity developer facing the same problem, however. I'm not sure there even is a solution at this point; is this perhaps intended (albeit very strange) Apple behavior? – WendiKidd May 04 '12 at 16:55
  • I’m having the same issue... I thought it was something I was doing wrong. – Cherr Skees May 16 '12 at 04:28
  • @DavidStucke Unfortunately not. Anyone want to file a bug report with Apple and see if they'll change it? ;) – WendiKidd May 17 '12 at 13:09
  • Same issue here, too new to iOS to have much insight as to what might be happening. It's fantastically irritating. – Reuben Scratton Jun 12 '12 at 21:37

2 Answers2

1

I had the same problem when I had another Game Center Account Authenticated. It happens when you login into some game with your normal account and at the same time with your test one.

Just reset your device settings and don't login with your real account into other games while testing. It happens when you do both at the same time. Reset your device settings, clean the project and it should be ok. And use only test iTunes accounts to test your game.

Taras Leskiv
  • 1,835
  • 15
  • 33
  • Just lost a few hours trying to figure out why my code was failing... Just logged out from GameCenter and it works, thanks Apple... – Gregory Aug 08 '14 at 20:21
-1

There are case for above problem 1. if you are using authentication method call two places in this situation it create a problem 2. if you use authentication method first time in class A and after executing then change their in place in class B without clean and rebuild

in both cases just clean and then rebuild.

I am also facing same problem but I have solution and solved.