iOS6游戏中心身份验证不起作用

时间:2014-04-20 06:28:12

标签: ios objective-c game-center

我可以使用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");
    }
};

}

它会使游戏中心被禁用..

1 个答案:

答案 0 :(得分:0)

原来我必须让GameCenter打开。