0

I'm having some strange problems with sprite kit throwing up when trying to destroy an SKShapeNode. The image below is an extract from the stack trace.

Has anyone seen this before? I don't seem to get this problem when using SKSpriteNodes (i.e., when BAJoint isa SKSpriteNode rather than an SKShapeNode.

enter image description here

In addition, if you look at the stack trace you will see a call to SKEffectNode's dealloc. I have not used SKEffectNodes anywhere in my application in any shape or form, so I'm puzzled why the SKEffectNode dealloc is being invoked.

Pinxaton
  • 437
  • 4
  • 13
  • 1
    I wonder if it's related to http://stackoverflow.com/questions/22399278/sprite-kit-ios-7-1-crash-on-removefromparent – Pinxaton Apr 26 '14 at 12:16
  • I found the problem. It turned out to be that I was destroying the scene while SKActions were running on the nodes in the scene. – Pinxaton May 04 '14 at 10:37

1 Answers1

2

Had the same problem, but finally I've solved it. I left you the link here

SKShapeNode producing crash sometimes on dealloc EXC_BAD_ACCESS

The solution was to call this method before dealloc the shapes (in my case, before I present a new scene)

- (void)cleanUpChildrenAndRemove:(SKNode*)node {
    for (SKNode *child in node.children) {
        [self cleanUpChildrenAndRemove:child];
    }
    [node removeFromParent];
}
Community
  • 1
  • 1
Draelach
  • 531
  • 3
  • 14
  • I've been searching for hours into how to debug EXC_BAD_ACCESS, how to look for zombies, how to even get stack trace or use auto release and malloc compares.. I was on the cusp of doing just this very thing - removing all nodes/stopping actions. I'm surprised that present scene doesn't cause this to happen. I experienced the same problem with having an SKEmitterNode in the scene. – GilesDMiddleton Aug 30 '14 at 12:14