I have a problem with logging a user to the Game Center. I first present the login dialog right after the application finishes loading. If the user cancels the dialog, I want to give him the option to change his mind by providing a login button in my main menu. However, on iPads with iOS7, the button doesn't do anything - the Game Center dialog doesn't get shown (it works correctly on iOS6). Instead, I immediately get the error "The requested operation has been cancelled or disabled by the user." Same code is called on application launch and on the button tap. It uses the authenticateWithCompletionHandler method and basically looks like:
GKLocalPlayer* localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error)
{
OnLogin(error);
}];
(I know the method is deprecated, but my experience with the new one has been even worse).
The interesting thing is that the GC dialog DOES appear if I move the application to the background and then bring it back to the foreground.
The issue I describe happens even after the first cancel, so I don't think it has anything to do with Game Center banning applications after 3 cancels.
Does anyone know how to fix this?
In regards to your comment, I found the Apple documentation that mentions Game Kit's policy of not asking a user to login again after they have cancelled login once.
It's in the Game Center Programming Guide under
Common Tasks When Working with Players
>Authenticating a Local Player on the Device
. (bold type is mine)You can confirm this by including an
NSLog
in the authentication handler to show each time the handler is called and whether it succeeded or failed. Hope this helps...