0

I tried to present leaderboards via this code block

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];
    }

And if I enabled all exception breakpoints, it will crash in the moment leaderboards are presented. When i delete this breakpoints, everything works fine. I am login into Game Center with test user. Is this a glitch or what ?

Igor Prusyazhnyuk
  • 133
  • 2
  • 14
  • 29
  • what crash, what exception message, where? Exception breakpoints halt when there is an exception, but the app may not be crashing if the exception is handled. Without more context the issue can't be solved. – CodeSmile May 12 '14 at 06:47
  • @LearnCocos2D It crashes on AppDelegates '@autoreleasepool' with objc_exception_throw in stack trace . And is marked as Thread 1: breakpoint 1.1. – Igor Prusyazhnyuk May 15 '14 at 23:53
  • That usually indicates you haven't added an exception breakpoint. https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html – CodeSmile May 16 '14 at 13:02

1 Answers1

0

I solved it via editing exception breakpoint from all to Objective-C exceptions . Tnx @LearnCocos2D for the answer

Igor Prusyazhnyuk
  • 133
  • 2
  • 14
  • 29