Ios 集成GameCenter时出错

Ios 集成GameCenter时出错,ios,xcode5,game-center,Ios,Xcode5,Game Center,所以,在过去的几天里,我一直在尝试将GameCenter添加到我的应用程序中,我发现一些教程似乎都不太管用,所以这是我在玩家打开应用程序时用来登录的代码 - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

所以,在过去的几天里,我一直在尝试将GameCenter添加到我的应用程序中,我发现一些教程似乎都不太管用,所以这是我在玩家打开应用程序时用来登录的代码

- (void)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
    localPlayer.authenticateHandler =
    [localPlayer authenticate];
}


GKLocalPlayer.authenticationHandler = ^(UIViewController *loginVC,
                                      NSError *error)
{
    if ([GKLocalPlayer localPlayer].authenticated) {

        [self enableGameCenterForPlayer:[GKLocalPlayer localPlayer]];
    }
    else if (loginVC) {

        [self pauseGame];
        [self presentLoginVC:loginVC];
    }
    else {

        [self disableGameCenter];
    }
};
但是我有两个错误,我不知道它们是什么意思,我是一个新手,所以有些事情是有意义的,有些是没有意义的,这就是其中之一,我想我已经看到了9到10种不同的方法

我觉得最好问问那些知道的人

下面是错误的屏幕截图


谢谢各位,非常感谢你们的帮助。

文档中根本没有身份验证方法。“要验证本地播放器,请通过调用localPlayer类方法检索本地播放器的共享实例并设置其authenticateHandler”,因此应删除第一行错误的内容。第二个错误行应指向localPlayer,并移动到方法中:

didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    LocalPlayer.authenticationHandler = ^(UIViewController *loginVC,
                                          NSError *error)
    {
         ...

对不起,我不太明白你的意思。我编辑了我的答案,让它更清楚。看起来您可能还需要学习如何使用块。带有块的变量不像方法那样添加,而是在方法中调用。