Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Game Center login dialog not shown again after cancelling it for the first time (iOS7)

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?

like image 226
user2986426 Avatar asked Jan 10 '14 11:01

user2986426


People also ask

How do I get my apple Game Center back?

Open Settings. Scroll to Game Center, then tap it.

Does Game Center save your progress?

Make sure you have connected your game to Game Center. It is the only way to save, recover and sync your progress. Your account is not saved via connecting it to Facebook.

Why can't my phone connect to Game Center?

Sign out of Game Center, then sign back in. If you can't sign in to Game Center with an Apple ID, reset your password or use another email address. To manage your Apple ID, go to My Apple ID. If you're using a Wi-Fi connection, make sure that your Wi-Fi router is configured for Game Center.

How do I unlink a game from Game Center 2022?

Basically you have to go to settings, general, iPhone or iPad storage, wait for your apps to load then find the Game Center app you want to remove from there. Swipe the app to the left and tap delete app.


1 Answers

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)

Important: Game Kit handles opting out of Game Center across all games that support Game Center. If a player has already declined to create an account, when your game authenticates the player, it is told there is no authenticated player. The player never sees an authentication dialog. Because Game Kit handles this process across all games, your game should not include its own mechanism to disable Game Center authentication or ask a player’s permission to authenticate. Instead, your game should simply authenticate the player every time it launches and respond appropriately when authentication completes.

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...

like image 104
Joseph Chen Avatar answered Oct 18 '22 22:10

Joseph Chen