iOS Development: Strange problem with authenticating Game Center user

BeachRunnerFred picture BeachRunnerFred · Jan 1, 2011 · Viewed 7k times · Source

I'm building an iPhone game that supports Game Center (GC). When the app launches, I try to authenticate the local player...

 if([GKLocalPlayer localPlayer].authenticated == NO)
    {
        [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) 
         {
             [self callDelegateOnMainThread: @selector(processGameCenterAuth:) withArg: NULL error: error];
         }];
    }

Everything seemed to be working well. If the user wasn't signed into GC when the app launched, the app would display a dialog box giving them three options...

  1. Sign into existing account
  2. Create an account
  3. Cancel

This is the desired behavior, but while I was testing, I clicked the "Cancel" option and now the authentication process errors out every time with the following error "The requested operation has been cancelled." Even when I delete the app and reinstall it, it still errors out and that dialog box never pops ups now.

Does anyone know why this is happening or how I can fix it?

Thanks in advance for your wisdom!

Answer

BeachRunnerFred picture BeachRunnerFred · Jan 1, 2011

It turns out that is apple undocumented behavior.

After 3 times a user press cancel in a row, he has to go to the Game Center app and connect from there.

Go Figure.