Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 游戏中心排行榜显示没有可用数据_Ios_Objective C_Game Center_Leaderboard - Fatal编程技术网

Ios 游戏中心排行榜显示没有可用数据

Ios 游戏中心排行榜显示没有可用数据,ios,objective-c,game-center,leaderboard,Ios,Objective C,Game Center,Leaderboard,我希望应用程序在用户登录游戏中心时显示所有排行榜。我编写了下面的代码来实现这一点,它工作正常,直到我断开网络连接 应用程序启动时没有网络,但本地游戏中心已登录。当我重新连接网络并点击显示排行榜时,它显示“没有可用数据”。我必须终止并重新打开应用程序才能使其正常工作 奇怪的是,如果我添加了setLeadboardIdentifier,并执行了上述相同的操作,那么在再次连接网络后,指定的排行榜可能会显示出来 有什么问题吗?谢谢 - (void)showGameCenter{ GKGameC

我希望应用程序在用户登录游戏中心时显示所有排行榜。我编写了下面的代码来实现这一点,它工作正常,直到我断开网络连接

应用程序启动时没有网络,但本地游戏中心已登录。当我重新连接网络并点击显示排行榜时,它显示“没有可用数据”。我必须终止并重新打开应用程序才能使其正常工作

奇怪的是,如果我添加了
setLeadboardIdentifier
,并执行了上述相同的操作,那么在再次连接网络后,指定的排行榜可能会显示出来

有什么问题吗?谢谢

- (void)showGameCenter{

    GKGameCenterViewController *gameView = [[GKGameCenterViewController alloc] init];
    if(gameView != nil){
        gameView.gameCenterDelegate = self;

        [gameView setViewState:GKGameCenterViewControllerStateLeaderboards];
        [gameView setLeaderboardTimeScope:GKLeaderboardTimeScopeAllTime];
//        //[gameView setLeaderboardIdentifier:@"xxxxxxxxx"];

        [self presentViewController: gameView animated: YES completion:nil];
    }        
}