Аутентификация GKLocalPlayer с помощью Game Center

Я пытаюсь аутентифицировать GKLocalPlayer с помощью Game Center. Однако код, предоставленный Apple

- (void) authenticateLocalPlayer
{
    [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
         if (error == nil)
         {
              // Insert code here to handle a successful authentication.
              NSLog(@"Logged in.");
         }
         else
         {
             // Your application can process the error parameter to report the error to the player.
             NSLog(@"%@", [error description]);
         }
     }];
}

, похоже, не помогает мне. Я всегда получаю предупреждение «Не удалось подключиться к серверу Game Center». с возможностью «Повторить» или «Отменить». Ни один из операторов NSLog не выполняется, поэтому я предполагаю, что завершениеHandler даже не запускается.

Если я нажимаю повтор, я получаю следующую ошибку:

Error Domain=GKErrorDomain Code=7 "The requested operation could not be completed because local player is already authenticating." UserInfo=0x8915f80 {NSLocalizedDescription=The requested operation could not be completed because local player is already authenticating.}

Кто-нибудь знает, что происходит не так?

6
задан Richard Slater 30 April 2017 в 21:22
поделиться