0

在 DidFinishLaunchingWithOptions 我正在尝试使用此代码对玩家进行身份验证

    // Authenticate Player with Game Center

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

// Handle the call back from Game Center Authentication

[localPlayer localPlayer.authenticateHandler:^(NSError *error)
 {
     if (localPlayer.isAuthenticated)
     {
         // Player was successfully authenticated.
         // Perform additional tasks for the authenticated player.
     }
     else if (error != nil)
     {
         NSLog(@"error : %@", [error description]);
     }
 }];



return YES;

}

但是我在这条线上得到错误[localPlayer localPlayer.authenticateHandler:^(NSError *error)说缺少方括号']'并且指向句号'。我无法让这个工作谢谢

4

1 回答 1

0

您没有向本地播放器实例发送消息,因此这在语法上是不正确的。

阅读

您应该执行以下操作:

[localPlayer setAuthenticateHandler:
    ^(UIViewController *viewController, NSError *error) {
        // ...
    }
];
于 2013-08-20T07:27:59.310 回答