title: Game Center Authenticating Problems
body: <p>Im Developing  a new app that uses game center, but unfortunatley im having troubles with game center authentication</p>
  
  <p>here is the authentication code im using:</p>
  
  <pre><code>@interface ViewController ()
  
  
  
  // A flag indicating whether the Game Center features can be used after a user has been authenticated.
  @property (nonatomic) BOOL gameCenterEnabled;
  
  // This property stores the default leaderboard's identifier.
  @property (nonatomic, strong) NSString *leaderboardIdentifier;
  
  
  @end
  
  
  @implementation ViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      [self authenticateLocalPlayer];
      _gameCenterEnabled = NO;
      _leaderboardIdentifier = @"LEADERBOARD ID HERE";
  }
  
  - (void)authenticateLocalPlayer {
      GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
      localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
          if (viewController != nil) {
              [self presentViewController:viewController animated:YES completion:nil];
          }
          else{
              if ([GKLocalPlayer localPlayer].authenticated) {
                  _gameCenterEnabled = YES;
                  [[GKLocalPlayer localPlayer] loadDefaultLeaderboardIdentifierWithCompletionHandler:^(NSString *leaderboardIdentifier, NSError *error) {
                      if (error != nil) {
                          NSLog(@"%@", [error localizedDescription]);
                      }
                      else{
                          _leaderboardIdentifier = leaderboardIdentifier;
                      }
                  }];
              }
              else {
                  _gameCenterEnabled = NO;
                  NSLog(@"Game Center Not available");
              }
          }
      };
  }
  </code></pre>
  
  <p>i double checked the app id, the leaderboard identifier and i have game center enabled in itunes connect,i also linked gamekit framework,and imported gamekit in View Controller.h, and i have sandbox mode enabled in game center</p>
  
  <p>im using Xcode 5.0.2 on OS X Mavericks</p>
  
  <p>Could Someone please Help? Its Making me CRAZYY!!</p>
  
  <p>Regards :)</p>