3

我在游戏开始时使用Apples Game Center让玩家登录,问题是我刚刚点击取消(最终测试),现在对话框不再出现,它只是一直走通过禁用。

这是我正在使用的功能。

-(void) setup
{
    gameCenterAuthenticationComplete = NO;

    if (!isGameCenterAPIAvailable()) {
        // Game Center is not available.
        NSLog(@"Game Center is not available.");
    } else {
        NSLog(@"Game Center is available.");

        __weak typeof(self) weakSelf = self; // removes retain cycle error

        GKLocalPlayer *localPlayer =  [GKLocalPlayer localPlayer]; // localPlayer is the public GKLocalPlayer

        __weak GKLocalPlayer *weakPlayer = localPlayer; // removes retain cycle error

        weakPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error)
        {
            if (viewController != nil)
            {
                NSLog(@"Try to show ViewController");
                [weakSelf showAuthenticationDialogWhenReasonable:viewController];
            }
            else if (weakPlayer.isAuthenticated)
            {
                NSLog(@"authenticate player");
                [weakSelf authenticatedPlayer:weakPlayer];
            }
            else
            {
                NSLog(@"disable");
                [weakSelf disableGameCenter];
            }
        };
    }

}

-(void)disableGameCenter
{

}

如您所见, disableGameCenter 实际上并没有做任何事情。

为什么我现在每次运行它都会禁用它?(使用模拟器),我怎样才能摆脱它,让对话再次出现?我是否必须以某种方式手动强制对话再次出现?

4

1 回答 1

0

我在 OSX 下遇到了类似的问题,在您“取消”Gamecenter 对话框几次后,它就停止出现了。

要找回它,请运行“游戏中心”,登录并注销 - 然后再次运行您的游戏,对话框将再次出现(它至少可以工作几次,直到您经常“取消”)。

于 2015-11-09T16:06:23.513 回答