Note that there are some explanatory texts on larger screens.

plurals
  1. POCrash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement)
    primarykey
    data
    text
    <p>I have a 100% reproducible crash here.</p> <p>Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement). It crashes instantly when pushing the home button.</p> <p>Crash on line 275 in CCGLView.m:</p> <pre><code>if(![_context presentRenderbuffer:GL_RENDERBUFFER]) </code></pre> <p>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.</p> <p><strong>Update:</strong></p> <p>The problem seems to be in the cocos2d app template in use in 2.1 and possibly earlier. It looks like this:</p> <pre><code>-(void) applicationDidEnterBackground:(UIApplication*)application { if( [navController_ visibleViewController] == director_ ) [director_ stopAnimation]; } </code></pre> <p>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).</p> <p>The current fix is to comment out <code>if( [navController_ visibleViewController] == director_ )</code> in order to have stopAnimation always called. Not sure if there are any side effects with that but will go with this for now.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COin the past week, that line of code has been associated (in this forum) with a number of oddballs : crash, leak, random sprite appearing out of the blue. For my part, just running the release version nukes the leak (substantial). Seems to be some issue with iOS7/debug as far as i could determine, and (possibly but not certain) that line.
      singulars
    2. COSo how come it does not crash on a fresh 2.1? Also, I have a live cocos2d game out there using the same class I use for dealing with scores and game center. It crashes the same way when backgrounding while in a game center view. It's certainly not debug mode. Try it if you like ( https://itunes.apple.com/jp/app/chitchaiossan-pyonpyon/id667884819?mt=8 ) On another possibly unrelated note I noticed that iOS7 once again changed how GC controllers should be displayed http://stackoverflow.com/a/19143224/129202 having a hard time keeping up with all versions here :-P
      singulars
    3. COWell, believe it or not : in my case, i have 2 IDE's (i only use xCode to play certificates and prep for release). So, same code base, run with AppCode : no leak. Run with xCode : massive leak on that line. Run with AppCode, but attach Instruments to a running process : leak. I was completely baffled by this thing. So dont be surprised : there is something broken (i think) in the buildForDebuggUnderIOS7 process within xcode.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload