<small id='ZEQCn'></small><noframes id='ZEQCn'>

  1. <tfoot id='ZEQCn'></tfoot>
    <i id='ZEQCn'><tr id='ZEQCn'><dt id='ZEQCn'><q id='ZEQCn'><span id='ZEQCn'><b id='ZEQCn'><form id='ZEQCn'><ins id='ZEQCn'></ins><ul id='ZEQCn'></ul><sub id='ZEQCn'></sub></form><legend id='ZEQCn'></legend><bdo id='ZEQCn'><pre id='ZEQCn'><center id='ZEQCn'></center></pre></bdo></b><th id='ZEQCn'></th></span></q></dt></tr></i><div id='ZEQCn'><tfoot id='ZEQCn'></tfoot><dl id='ZEQCn'><fieldset id='ZEQCn'></fieldset></dl></div>
      <bdo id='ZEQCn'></bdo><ul id='ZEQCn'></ul>

      <legend id='ZEQCn'><style id='ZEQCn'><dir id='ZEQCn'><q id='ZEQCn'></q></dir></style></legend>
    1. 观看 Game Center 屏幕(排行榜、成就)时,如果在 iOS7 中后台运行 cocos2d 2.1 应用程序会崩

      时间:2024-08-12

          <tbody id='MvXt5'></tbody>
      1. <legend id='MvXt5'><style id='MvXt5'><dir id='MvXt5'><q id='MvXt5'></q></dir></style></legend>

        • <i id='MvXt5'><tr id='MvXt5'><dt id='MvXt5'><q id='MvXt5'><span id='MvXt5'><b id='MvXt5'><form id='MvXt5'><ins id='MvXt5'></ins><ul id='MvXt5'></ul><sub id='MvXt5'></sub></form><legend id='MvXt5'></legend><bdo id='MvXt5'><pre id='MvXt5'><center id='MvXt5'></center></pre></bdo></b><th id='MvXt5'></th></span></q></dt></tr></i><div id='MvXt5'><tfoot id='MvXt5'></tfoot><dl id='MvXt5'><fieldset id='MvXt5'></fieldset></dl></div>

          <small id='MvXt5'></small><noframes id='MvXt5'>

              <bdo id='MvXt5'></bdo><ul id='MvXt5'></ul>
                <tfoot id='MvXt5'></tfoot>
                本文介绍了观看 Game Center 屏幕(排行榜、成就)时,如果在 iOS7 中后台运行 cocos2d 2.1 应用程序会崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我这里有一个 100% 可重现的崩溃.

                I have a 100% reproducible crash here.

                如果在 iOS7 中后台运行 cocos2d 2.1 应用程序同时观看 Game Center 屏幕(排行榜、成就)会崩溃.按下主页按钮时它会立即崩溃.

                Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement). It crashes instantly when pushing the home button.

                CCGLView.m 中的第 275 行崩溃:

                Crash on line 275 in CCGLView.m:

                if(![_context presentRenderbuffer:GL_RENDERBUFFER])
                

                令人头疼的是,我下载了官方 cocos2diphone 2.1 的新副本,安装了它的模板并在将其连接到与我已经有游戏中心排行榜等设置的有问题的应用程序相同的应用程序 ID 后运行主应用程序向上.它不会崩溃.所以我在lib里面的cocos2d文件夹上运行了一个diff,除了我在CCDrawingPrimitives.h/m中添加了一些C函数代码之外没有什么区别......应该不是问题.所以问题不应该出在 cocos2d 本身,而是不知何故使用它或我的项目设置导致它.

                The itching thing is, I downloaded a fresh copy of official cocos2diphone 2.1 the other second, installed its templates and ran the staple application after hooking it up to the same app id as my problematic app that already have game center leaderboards etc set up. It does not crash. So I ran a diff on the cocos2d folders inside lib, and there is no difference except I added some C functions code in CCDrawingPrimitives.h/m... Should not be the problem. So the problem should not be in cocos2d itself but somehow the use of it or my project setup causes it.

                更新:

                问题似乎出在 2.1 甚至更早版本中使用的 cocos2d 应用程序模板中.它看起来像这样:

                The problem seems to be in the cocos2d app template in use in 2.1 and possibly earlier. It looks like this:

                -(void) applicationDidEnterBackground:(UIApplication*)application
                {
                    if( [navController_ visibleViewController] == director_ )
                        [director_ stopAnimation];
                }
                

                这里明显的错误是,如果你让 navController 打开一个 Game Center 控制器,那么当按下主页按钮时,director_ 的 visibleViewController 将是 GC 控制器,因此 stopAnimation 不会被调用.这会导致 iOS7 崩溃,但 iOS6 似乎不会崩溃......模板 cocos2d 2.1 应用程序也不会(这里仍然很困惑).

                And the obvious fault here is that if you have navController open a Game Center controller, then when pushing the home button the visibleViewController of director_ will be the GC controller, hence the stopAnimation will not get called. This results in a crash with iOS7, but doesn't seem to with iOS6... nor the template cocos2d 2.1 app (still confused here).

                当前的修复方法是注释掉 if( [navController_ visibleViewController] == director_ ) 以便始终调用 stopAnimation.不确定是否有任何副作用,但现在会继续使用.

                The current fix is to comment out if( [navController_ visibleViewController] == director_ ) in order to have stopAnimation always called. Not sure if there are any side effects with that but will go with this for now.

                推荐答案

                Good Call.我遇到了和你一样的问题,你的帖子帮助我弄清楚我的应用程序是如何崩溃的.

                Good Call. I ran into the same issue as you do and your post helped me to figure out how my app crashed.

                所以我的解决方案是在显示游戏中心之前停止导演动画.

                So my solution is stop director animation before showing game center.

                [[CCDirector sharedDirector] stopAnimation]
                [[CCDirector sharedDirector] presentViewController:gcViewController animated:YES completion:nil];
                

                然后在游戏中心视图中重启动画关闭回调

                Then restart animation in the game center view dismiss callback

                - (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController
                {
                    [[CCDirector sharedDirector] dismissViewControllerAnimated:YES completion:nil];
                    [[CCDirector sharedDirector] startAnimation];
                }
                

                您更新的解决方案应该可以工作,但在这里也是一样,我不确定是否会有任何副作用.我想将游戏中心本身包裹起来是一种更安全的方法.

                Your updated solution should work, but same here, I am not sure if there would be any side effects. I guess it is a safer approach to just wrap around the game center itself.

                再次感谢您发布这个问题!

                Thanks again for posting this question!

                这篇关于观看 Game Center 屏幕(排行榜、成就)时,如果在 iOS7 中后台运行 cocos2d 2.1 应用程序会崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:为什么 xcode 归档成功但创建一个空的 .xcarchive 文件? 下一篇:UIGestureRecognizers (iPhone, Cocos2d) 的多种手势

                相关文章

                <i id='dWASR'><tr id='dWASR'><dt id='dWASR'><q id='dWASR'><span id='dWASR'><b id='dWASR'><form id='dWASR'><ins id='dWASR'></ins><ul id='dWASR'></ul><sub id='dWASR'></sub></form><legend id='dWASR'></legend><bdo id='dWASR'><pre id='dWASR'><center id='dWASR'></center></pre></bdo></b><th id='dWASR'></th></span></q></dt></tr></i><div id='dWASR'><tfoot id='dWASR'></tfoot><dl id='dWASR'><fieldset id='dWASR'></fieldset></dl></div>
                • <bdo id='dWASR'></bdo><ul id='dWASR'></ul>
              • <small id='dWASR'></small><noframes id='dWASR'>

              • <legend id='dWASR'><style id='dWASR'><dir id='dWASR'><q id='dWASR'></q></dir></style></legend>

              • <tfoot id='dWASR'></tfoot>