我可以使用iOS7登录GameCenter,但使用iOS 6我无法登录:
-(void)authenticateLocalUser
{
__weak GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error)
{
if(viewController)
{
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:viewController animated:YES completion:nil];
}
else if(localPlayer.isAuthenticated == YES)
{
[localPlayer generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) {
if(error != nil)
{
return; //some sort of error, can't authenticate right now
}
}];
}
else
{
NSLog(@"game center disabled");
}
};
}
它会使游戏中心被禁用..
答案 0 :(得分:0)
原来我必须让GameCenter打开。