【问题标题】:Undefined behaviour of GameCenter leaderboards with SpriteKit使用 SpriteKit 的 GameCenter 排行榜的未定义行为
【发布时间】:2014-05-18 00:50:14
【问题描述】:

我尝试通过此代码块显示排行榜

if ([GKLocalPlayer localPlayer].isAuthenticated) {
    GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
    if (gameCenterController != nil)
    {
        gameCenterController.gameCenterDelegate = self;
        gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
        UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: gameCenterController animated:YES completion:Nil];
    }
    }else{
            UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"You must enable Game Center"
                                                              message:@"Sign in through the Game Center app to enable all features"
                                                             delegate:nil
                                                    cancelButtonTitle:@"OK"
                                                    otherButtonTitles:nil];
            [message show];
    }

如果我启用了所有异常断点,它会在排行榜出现的那一刻崩溃。当我删除这个断点时,一切正常。我正在使用测试用户登录游戏中心。这是故障还是什么?

【问题讨论】:

  • 什么崩溃,什么异常信息,在哪里?异常断点会在出现异常时停止,但如果处理了异常,应用程序可能不会崩溃。没有更多上下文,问题就无法解决。
  • @LearnCocos2D 它在 AppDelegates '@autoreleasepool' 上崩溃,堆栈跟踪中的 objc_exception_throw 。并被标记为 Thread 1: breakpoint 1.1。
  • 这通常表明你没有添加异常断点。 developer.apple.com/library/ios/recipes/…

标签: sprite-kit game-center game-center-leaderboard


【解决方案1】:

我通过编辑从 all 到 Objective-C exceptions 的异常断点解决了这个问题。 Tnx @LearnCocos2D 给出答案

【讨论】:

    猜你喜欢
    • 2013-06-03
    • 1970-01-01
    • 2011-05-27
    • 1970-01-01
    • 1970-01-01
    • 2020-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多