cocos2d,游戏中心排行榜不工作
我在显示排行榜时遇到问题。我认为我是对的,但我在日志中收到此错误
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该有效。
This should work.
不要将视图添加到 CCDirector 的 openglview
我假设您的 AppDelegate 中有此代码...如果是这样,请执行以下操作:
而不是
也...将此代码移到
presentModalViewController
之前don't add the view to CCDirector's openglview
i assume you have this code in your AppDelegate...if so do this:
instead of
also..move this code before
presentModalViewController