I have a main menu which launches a view controller with an SKView/SKScene via a modal segue. I then call dismissViewControllerAnimated, which returns the app to the main menu, but I can still hear sound effects from the SKScene. When I relaunch the SKScene multiple times the app eventually crashes.
I've tried following a heapshot analysis tutorial (http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/) but I don't seem to be getting anywhere. I've made sure to deallocate all strong @properties...
Any ideas on what might be causing this issue? Would any code/screenshots be helpful, or can I provide any information to help narrow down the issue?
It is difficult to know from the information provided. I can tell you I had a similar issue and it turned out to be related to SKAction objects. I was cacheing the Actions as properties of the scene and then having child nodes run those actions. I found that ensuring that the child nodes called removeAllActions eliminated the issue for me. Something along the lines of:
-(void) willMoveFromView:(SKView *)view
{
[self.children enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
SKNode* child = obj;
[child removeAllActions];
}];
[self removeAllChildren];
}
Not sure if this is what you're facing, but may be something to look out for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With