0

In iOS 6 it is now necessary to authenticate game center like this:

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
    if (viewController != nil)
    {


        [[AppDelegate sharedDelegate].viewController  presentModalViewController:viewController animated:YES];


         }
         else if (localPlayer.isAuthenticated)
         {   
             [self authenticatedGC];
         }
         else
         {
             [self disableGC];
         }
        };

}

This code runs fine on my iphone 4 running iOS6, but crashes on my iOS 6 simulator with this stack trace:

0 objc_msgSend
1 -[GKLocalPlayer setAuthenticateHandler:]
2 -[GCHelper authenticateLocalUser]
3 -[AppDelegate applicationDidFinishLaunching

I tried to reinstall xcode thinking the simulator was missing the iOS 6 sdk or something but it still crashes here.

Any ideas?

Thank you!

Marcus Schwab
  • 348
  • 3
  • 10

1 Answers1

0

You might want to checkout this question, because your app might be crashing due to autorotation issues and game center, not the authentication mechanism itself

Community
  • 1
  • 1
Lio
  • 4,225
  • 4
  • 33
  • 40
  • I already have that solution implemented and it doesn't crash on the device and rotation works as well. It's only a crash in the iOS 6.0 Simulator. Thanks! – Marcus Schwab Sep 28 '12 at 00:24