简体   繁体   中英

iOS Development: Strange problem with authenticating Game Center user

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM