我在Cocos2d-iPhone中構建遊戲,當我更新到iOS 6時,我注意到Apple改變了Game Center身份驗證的方式,使用authenticateHandler
而不是authenticateWithCompletionHandler
。iOS 6遊戲中心身份驗證崩潰
我添加了新的身份驗證方法,但如果一個球員是不是已經登錄到遊戲中心現在遊戲崩潰。有沒有問題,如果用戶已經登錄認證
這裏是我的代碼:
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");
}
};
}
好像它試圖呈現遊戲中心的viewController時崩潰,即使我使用完全相同的代碼來呈現沒有問題的GKTurnBasedMatchmakerViewController
。
任何幫助將不勝感激。
編輯: 這裏是例外,越來越扔在崩潰:
Uncaught Exception UIApplicationInvalidInterfaceOrientation: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES
崩潰的顯示詳細信息。日誌輸出,崩潰報告等 –
我編輯我的帖子,包括未處理的異常。那是你需要的嗎? –
我發現這一點:HTTP://stackoverflow.com/questions/12427979/gamecenter-authentication-in-landscape-only-app-throws-uiapplicationinvalidinter。現在不會崩潰,但它將在縱向而不是橫向上啓動GC模式視圖。 –