0

在 iOS 6 中,现在需要像这样对游戏中心进行身份验证:

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];
         }
        };

}

这段代码在我运行 iOS6 的 iphone 4 上运行良好,但在我的 iOS 6 模拟器上崩溃,并带有以下堆栈跟踪:

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

我试图重新安装 xcode,以为模拟器缺少 iOS 6 sdk 或其他东西,但它仍然在这里崩溃。

有任何想法吗?

谢谢!

4

1 回答 1

0

您可能想检查这个问题,因为您的应用程序可能由于自动旋转问题和游戏中心而崩溃,而不是身份验证机制本身

于 2012-09-27T15:50:20.617 回答