In my main scene I create 4 walls with this method:
-(void)createFirstWalls{
CGFloat maxY = CGRectGetMaxY(self.frame);
Wall* wall1=[Wall wallWithRect:se
One possible cause is that you aren't releasing the CGPathRef object. See this question/answer.
Try adding these two lines after last using the path:
self.path=path;
CGPathRelease(path);
path = nil;
Also there used to be a bug where removing SKShapeNodes caused a crash. Be sure to run the latest Xcode 5 version / iOS 7.1 SDK.
It seems to be a bug with the SKShapeNode in iOS 7.1 ...
But finally I found the answer!!! Hope this can help more people.
I implemented a method to remove all the childs in the current node
- (void)cleanUpChildrenAndRemove:(SKNode*)node {
for (SKNode *child in node.children) {
[self cleanUpChildrenAndRemove:child];
}
[node removeFromParent];
}
And then call that function before I present a new scene
[self cleanUpChildrenAndRemove:self]; //god bless this method
SKScene* gameOver =[GameOver sceneWithSize:self.view.bounds.size];
gameOver.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:gameOver];
No more crashes nor BAD_EXC... A true miracle.