10

I'm developing a unity iphone game.

short version: game center can be disabled when the user declines to authenticate 3 times. Can this disabled state be detected?

Long version: In case some of you hadn't had the horror of finding this out yet, if you cancel a game-center authentication attempt 3 times, game center stops prompting you to log in. after that, no game-center functionality will work, nor will you be notified when attempting to use it. you just get nothing. your buttons will go dead.

there is, however, one non-descript error message that gets returned by GC. I figgured -- hey, I'm just going to stick a little alertview in there when the error message gets returned, notifying the user that game center is disabled.

well, that would be foolish, because it turns out that that particular error message gets displayed when you hit cancel on the actual authentication prompt as well... and even in other situations I believe. so as of now, I have a choice between never telling the player when game-center is disabled, and hoping they figgure it out, or spamming them in an anoying, broken-looking way when they genuinely decline and here-and-there as well.

Is there a way to just programatically detect when game center has become disabled in this way? that sure would save everyone the goddamn heartache. I'm assuming that the answer is no, because not spaming users was the probably the thinking behind this in the firstplace. tell me I'm wrong, someone!

hypnoslave
  • 123
  • 1
  • 5
  • [Related](http://stackoverflow.com/questions/18927723/reenabling-gamecenter-after-user-cancelled-3-times-ios7-only) – bobobobo Nov 06 '13 at 17:15

4 Answers4

3

I always check my game for 3 incorrect attempts. It so i know gamecenter is disabled and i give the user the option to switch to gamecenter and login when they click on a gamecenter button.

Roel
  • 39
  • 2
2

I had the same bug recently and figured out the following. When you authenticate the local player you can catch an error which lets you know that Game Center is disabled.

- (void) authenticateLocalPlayer
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    [localPlayer authenticateWithCompletionHandler:^(NSError *error) {
         if (error != nil)
         {
             // You get here if Game Center is disabled -- check error
             // to figure out what's going on.
         }
     }];
}

See here for Apple's documentation.

Alex Flanagan
  • 557
  • 4
  • 9
  • 2
    The error is always `Error Domain=GKErrorDomain Code=2 "The requested operation has been cancelled." UserInfo=0xa564f10 {NSLocalizedDescription=The requested operation has been cancelled.}` whether the user has only canceled the Game Center modal or disabled it for the app completely. – dvs Jan 20 '13 at 17:10
  • Actually I am getting _The requested operation has been cancelled _or disabled by the user_._ – bobobobo Nov 06 '13 at 16:54
2

As I know, there is no way. Game center is not completely disabled but you need to go to the Game center application and login from there to use it again. So you can suggest your users to do it (login from the game center app) if any attempt to use game center fails. It is not the best solution since you don't know the exact reason it failed, but by now I haven't found a better one.

Luis
  • 1,282
  • 1
  • 11
  • 25
-7

The only way to solve this on iOS 7 is

Settings / General / Reset / Reset All Settings

From there, you just launch your app again. Game Center logins will work again.

bobobobo
  • 64,917
  • 62
  • 258
  • 363
  • 2
    Can someone edit this blatantly irrelevant answer displayed in super-bold type? –  Mar 01 '14 at 03:09