Strange EXC_BAD_ACCESS SpriteKit removeSubsprite crash

I am new to SpriteKit

and just created my first game. Everything worked fine until iOS 7.1. Now, several times passing to a new level and presenting a new one Scene

, it falls. I don't think I am representing it in the wrong way:

ZSSMyScene *nextLevel = [[ZSSMyScene alloc] initWithSize:self.size level:self.level score:score];
[self.view presentScene:nextLevel];

      

I am getting an error EXC_BAD_ACCESS

and it looks like this is happening on removeSubsprite

, but I can't find anywhere in my code that I would remove the subroutine:

enter image description here

Not sure what information you want to provide as this is just an obscure bug that seemed to start when I was upgrading to the iOS 7.1 SDK.

+2


source to share


1 answer


This seems to be a bug, possibly with SKShapeNodes only.

My solution was to create a SKNode category and call this cleanup method if I have a node I have children.



- (void)cleanUpChildrenAndRemove {
    for (SKNode *child in self.children) {
        [child cleanUpChildrenAndRemove];
    }
    [self removeFromParent];
}

      

+1


source







All Articles