ios - GameCenter iOS 排行榜标识符

标签 ios objective-c xcode app-store-connect game-center

这是我在游戏中心获取默认排行榜但返回零值的代码。

我在 iTunes 连接中有此信息,我该怎么办?谢谢

此图片来自 iTunes Connect

This image is from iTunes Connect

这是来自 Xcode This is from Xcode

这是来自设备 This is from device

以及获取默认排行榜的代码

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 * _Nullable leaderboardIdentifier, NSError * _Nullable error) {


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

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

                    }

                }];
            }else{

                _gameCenterEnabled=NO;
            }
        }

    };

最佳答案

您的代码看起来不错。您是否尝试在设备上退出并重新登录游戏中心?我在沙盒模式下也遇到过几次这种情况,注销并重新登录通常可以修复它。

关于ios - GameCenter iOS 排行榜标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35645612/

相关文章:

ios - iOS 应用程序中 LaTex、MathML 和 XHTMLMathML 之间的权衡?

ios - 无法通过 Swift 中的计数器循环

ios - 使用 UISegmentedControl 在 UITextField 上启用编辑

xcode - 没有可编译的体系结构(ONLY_ACTIVE_ARCH=YES,事件 arch=x86_64,VALID_ARCHS=armv7 armv7s)

ios - UILabel作为tableViewCell的accessoryView向上移动

objective-c - 仅从 Objective-C 中的 html 内容中提取文本

objective-c - 接受 iPhoto 或 Aperture 的拖放

ios - 为什么我需要在为对象属性赋值之前分配/初始化一个类的实例?

iphone - 以用户友好的方式预加载数据

iphone - UITableViewCell 中可点击的电话号码