spritekit ios8中的Game Center身份验证

时间:2014-11-07 03:29:50

标签: ios game-center

使用ios8,苹果会改变您对玩家进行身份验证的方式。我用过:

- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];

// Configure the view.
SKView * skView = (SKView *)self.view;
if (!skView.scene) {


    // Create and configure the scene.
    SKScene * scene = [MainMenu sceneWithSize:skView.bounds.size];
    scene.scaleMode = SKSceneScaleModeAspectFill;


    [skView presentScene:scene];
    [self authenticateLocalPlayer];

}
}
- (void) authenticateLocalPlayer
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
    if (localPlayer.isAuthenticated)
    {
        // Perform additional tasks for the authenticated player.
    }
}];

}

在其他游戏中运行良好,但现在一旦应用程序加载就会崩溃。有什么想法吗?

0 个答案:

没有答案