这真让我抓狂。每次我尝试使用 Game Center 对本地玩家进行身份验证时,我都会得到一个 thread-1 sigkill。localPlayer
在我像这样设置之后它异步发生authenticateHandler
:
- (void)authenticateLocalPlayer
{
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0)
{
GKLocalPlayer __weak *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error)
{
if (viewController != nil)
{
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:viewController animated:YES completion:nil];
}
else if (localPlayer.isAuthenticated)
{
NSLog(@"Player authenticated");
}
else
{
NSLog(@"Player authentication failed");
}
};
}
}
有任何想法吗?