3

In ios6, I use the following code to authenticate on game center:

    [GKLocalPlayer localPlayer].authenticateHandler = ^(UIViewController* viewController, NSError* error)
    {
    if (error != nil)
   {
        return;
    }
    else
    {
        if (viewController != nil)
        {
            [rootViewController presentModalViewController:viewController animated:YES];
        }
    }

The code above is bind to a button. Things works fine if the users correctly entered their username and password. However, if the user canceled the viewController and then tab the button again, the code block is never entered again. I want to show the login viewController after each time the user tabs the button (or at least for the first two or three times). How could I update my code?

Thanks for your reply

Nick C
  • 514
  • 3
  • 12
user2353228
  • 175
  • 1
  • 1
  • 9

1 Answers1

2

This is by Apple's design and has nothing to do with your button. This has been noted elsewhere on StackOverflow too, and by me in my own work.

Ken
  • 30,811
  • 34
  • 116
  • 155
  • So how do you decide to deal with it finally? Just leave the button no reaction? I think it's weired for the user to find that after the canceled the view and tap again, there's nothing happens...... – user2353228 Sep 09 '13 at 02:51
  • It may be weird, but that's how it is. – Ken Sep 09 '13 at 02:53
  • e.g. http://stackoverflow.com/questions/12870041/ios-6-game-center-authenticatehandler-cant-login-after-a-cancel – Ken Sep 09 '13 at 03:02
  • Thanks for your reply. I think maybe I have to accept the fact. I also find that, if I home my game and reopen it, the button can then function properly again. That is, if user canceled the login view, they should quit the app and open again to make the login show again. How weired it is ...... – user2353228 Sep 09 '13 at 03:02
  • See what Apple says in iOS sev- in the next release of iOS. – Ken Sep 09 '13 at 03:13
  • I tried to use the deprecated call authenticateWithCompletionHandler: to solve the problem. It works fine on IOS6. However, on IOS7, it's out of work again......Is there any way to popup the authentication view after canceled on IOS7? – user2353228 Sep 13 '13 at 03:16