cocos2d,游戏中心排行榜不工作

发布于 2024-12-25 02:56:42 字数 1134 浏览 1 评论 0原文

我在显示排行榜时遇到问题。我认为我是对的,但我在日志中收到此错误

Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x105e39c0>. 

这是我用于显示和隐藏视图的代码

- (void)showLeaderboard
{
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != NULL)
    {   CCLOG( @" leaderboardController ok...");
        tempVC = [[UIViewController alloc] init];
        leaderboardController.leaderboardDelegate = self;
        [[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];

        leaderboardController.category =     @"com.bluemesasoftware.housedefender.hightestscore";

    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardController.leaderboardDelegate = self;
    [tempVC presentModalViewController: leaderboardController animated: YES];
}
}

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController  
{
    [tempVC dismissModalViewControllerAnimated:YES];
    [tempVC.view.superview removeFromSuperview];
    [tempVC release];
}

I'm having a problem getting leaderboards to show. I think I have it right but I get this error in the log

Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x105e39c0>. 

here's my code to show and hide the view

- (void)showLeaderboard
{
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != NULL)
    {   CCLOG( @" leaderboardController ok...");
        tempVC = [[UIViewController alloc] init];
        leaderboardController.leaderboardDelegate = self;
        [[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];

        leaderboardController.category =     @"com.bluemesasoftware.housedefender.hightestscore";

    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardController.leaderboardDelegate = self;
    [tempVC presentModalViewController: leaderboardController animated: YES];
}
}

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController  
{
    [tempVC dismissModalViewControllerAnimated:YES];
    [tempVC.view.superview removeFromSuperview];
    [tempVC release];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叫嚣ゝ 2025-01-01 02:56:42
[tempVC presentModalViewController: leaderboardController animated: NO]; 

[tempVC dismissModalViewControllerAnimated:YES]; 

这应该有效。

[tempVC presentModalViewController: leaderboardController animated: NO]; 

[tempVC dismissModalViewControllerAnimated:YES]; 

This should work.

寂寞美少年 2025-01-01 02:56:42

不要将视图添加到 CCDirector 的 openglview

我假设您的 AppDelegate 中有此代码...如果是这样,请执行以下操作:

[window.rootViewControler.view addSubview:tempVC.view];

而不是

[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];

也...将此代码移到 presentModalViewController 之前

don't add the view to CCDirector's openglview

i assume you have this code in your AppDelegate...if so do this:

[window.rootViewControler.view addSubview:tempVC.view];

instead of

[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];

also..move this code before presentModalViewController

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文