When I test my app on my iPad I can consistently and reliably get it to crash. When it does, I get an EXC_BAD_ACCESS error in main, and the root cause is far from obvious. I have tried the following steps to try to shed more light on it:
- I have enabled zombies. This doesn't seem to have had any affect at all in the output, which makes me think this is not a zombie issue (but clearly I could be wrong).
- I have add an exception breakpoint, but when the app crashes, the exception breakpoint doesn't kick in, and all I get is the standard green arrow next to line 16 of main.
- I have run the Analyzer and corrected the few minor error that were revealed there. Still, no effect.
- I have confirmed that the same problem is occurring for two of my testers who receive the build via test flight.
- I have performed a 'Clean' as well as a 'Clean Build Folder'
Here is whats especially weird. When I test on the iPad the app crashes consistently. When I test in a simulator it will not crash no matter what I do. So if it IS a zombie I am at a loss as to how to discover which object need retained better. Further, if I test on my iPhone, the app also does not crash.
Where the crash occurs: In the app, I have a number of sprite nodes that display information, when I touch one of them (actually, what I am touching is a child sprite made to look like a cancel button), what is supposed to happen is that I remove the cancel button's parent from its parent with:
[[self parent] removeFromParent];
Pic of call stack:
There is nothing in the console in the main xcode window, but this is in the console of the device (from the organizer window:
Apr 10 08:50:39 Roberts-iPad com.apple.debugserver-310.2[596] <Warning>: 69 +0.000164 sec [0254/060b]: far -> 788
Apr 10 08:50:39 Roberts-iPad com.apple.debugserver-310.2[596] <Warning>: 70 +0.000079 sec [0254/060b]: esr -> 796
Apr 10 08:50:39 Roberts-iPad com.apple.debugserver-310.2[596] <Warning>: 71 +0.000081 sec [0254/060b]: exception -> 800
Apr 10 08:50:42 Roberts-iPad backboardd[31] <Error>: HID: The 'Passive' connection 'Bubble Fit' access to protected services is denied.
Apr 10 08:50:43 Roberts-iPad backboardd[31] <Warning>: CoreAnimation: updates deferred for too long
Apr 10 08:50:57 Roberts-iPad lockdownd[25] <Notice>: 01cdc000 _select_socket: receive secure message timeout!
Apr 10 08:50:57 Roberts-iPad lockdownd[25] <Notice>: 01cdc000 _receive_message: walk away - non-SSL 1
Up until yesterday I thought I was very, very close to shipping :P I would appreciate any advice on how to shed more light on what the root cause of this exception is. Thanks!
UPDATE: As LearnCocos2D points out below, I may very well have the same SpriteKit bug he links to. The suggestion is to override removeFromParent. I tried this, but it produces an error:
- (void)removeFromParent
{
[self removeFromParent];
self = nil;
[super removeFromParent];
}
The error it produces is that self cannot be assigned to outside of init. How should I rewrite that?