GameCenter iOS leaderboard identifier

this is my code to get the default leaderboard in game center but return a nil value.

and i have this info in the iTunes connect what can i do? thanks

This image is from iTunes Connect

This is from Xcode

This is from device

and the code to obtain the default leaderboard

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
        if (viewController != nil) {
            [self presentViewController:viewController animated:YES completion:nil];
            if ([GKLocalPlayer localPlayer].authenticated) {
                _gameCenterEnabled = YES;

                [[GKLocalPlayer localPlayer]loadDefaultLeaderboardIdentifierWithCompletionHandler:^(NSString * _Nullable leaderboardIdentifier, NSError * _Nullable error) {

                    if (error != nil) {
                        NSLog(@"%@",[error localizedDescription]);

                        _leaderboardIdentifier = leaderboardIdentifier; // **This contains nil value**






You code looks fine. Did you try signing out and back into Game Center on your device? I have this happening to me a few times in sandbox mode as well and a signing out and back in usually fixes it.

I solve this strange problem creating a new leaderboard and create a new version of my application for example 1.1 and this works for me.

Thanks for your answer crashoverride777

Need Your Help

Adding a UIWindow in xcode iPhone SDK

iphone xcode sdk jailbreak uiwindow

I am creating a project in which i have to change the main.m file, so that UIApplication doesnt appear straight away, so i deleted the following line from main.m