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!