title: GKLocalPlayer authentication not working, but isAuthenticated returns YES (Game Center sandbox)
body: <p>I'm working on integrating turn based matches in my game and a few days ago I started getting weird errors from the GameKit API saying that the local player is not authenticated, even though he is.</p>
  
  <p>When I launch the app, the <code>authenticateHandler</code> is called, the view controller is displayed and after entering the password, the <code>authenticaHandler</code> is called again and the local player seems to be authenticated. <code>isAuthenticated</code> returns <code>YES</code>.</p>
  
  <p>But as soon as I start using any of the GameKit APIs like <code>loadFriendsWithCompletionHandler:</code>, an error is returned saying that the player has not been authenticated.</p>
  
  <p>This is the code for handling authentication changes.</p>
  
  <pre><code>[[GKLocalPlayer localPlayer] setAuthenticateHandler:^(UIViewController *viewController, NSError *error) {
      if ([[GKLocalPlayer localPlayer] isAuthenticated]) {
          // Player authenticated
      } else {
          // Player not authenticated
  
          if (viewController != nil) {
              // Present view controller
          }
      }
  }];
  </code></pre>
  
  <p>And this is the error message I receive when calling any of the GameKit methods. Please note that <code>-isAuthenticated</code> still returns YES when the error is returned.</p>
  
  <blockquote>
    <p>Error finding match: Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo=0x14e9f950 {NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}<br>
    (lldb) print (BOOL) [[GKLocalPlayer localPlayer] isAuthenticated]
    (BOOL) $3 = YES</p>
  </blockquote>
  
  <p>I'm testing in the Game Center sandbox and it started happening a few days ago. Previously, I didn't experience the problem at all.<br>
  It only happens about one of three times when the app is started. I have tried deleting the app, restarting my devices, cleaning the build folder and everything else I could think of.</p>
  
  <p>Am I missing something or has anybody else experienced similar problems?</p>