iOS 6 Game Center Crash na Autenticação
Eu estou construindo um jogo no Cocos2d-iPhone, e enquanto eu estava atualizando para o iOS 6, notei que a Apple mudou a forma como a autenticação do Game Center é feita, usandoauthenticateHandler
ao invés deauthenticateWithCompletionHandler
.
Eu adicionei o novo método de autenticação, mas o jogo agora falha se um jogador não estiver logado no Game Center. Não há problema em autenticar se um usuário já está conectado.
Aqui está o meu código:
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0"))
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error)
{
if (viewController != nil)
{
AppController *appDelegate = (AppController*)[UIApplication sharedApplication].delegate;
[delegate.viewController presentViewController:viewController animated:YES completion:nil];
}
else if (localPlayer.isAuthenticated)
{
NSLog(@"Player authenticated");
}
else
{
NSLog(@"Player authentication failed");
}
};
}
Parece que está falhando ao tentar apresentar o viewController do Game Center, mesmo que eu use exatamente o mesmo código para apresentar oGKTurnBasedMatchmakerViewController
sem problemas.
Qualquer ajuda seria muito apreciada.
EDIT: Aqui está a exceção sendo lançada em acidente:
Uncaught Exception UIApplicationInvalidInterfaceOrientation: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES