Sprite Kit iOS 7.1 crash on removeFromParent

前端 未结 5 694
眼角桃花
眼角桃花 2020-11-28 10:20

I have updated iPad Air to 7.1 and Xcode to 5.1. Xcode wanted to update my project to recommended settings, I agreed.

After that my game began crashing in a couple o

5条回答
  •  执笔经年
    2020-11-28 10:49

    I am also experiencing the crash. However, the solutions to override the removeFromParent method and setting the SKShapeNode to nil didn't work for me.

    I did discover that my crash was the combination of:

    1. Having a SKShapeNode (either a subclass OR a child of a SKNode)

    2. Having a SKPhysicsNode attached to a node (attached to a parent SKNode OR the SKShapeNode).

    3. Calling the method removeFromParent

    The solution I ended up using was overriding the removeFromParent method in my SKShapeNode subclass with the following:

    - (void)removeFromParent
    {
        if( self.physicsBody != nil )
        {
            self.physicsBody = nil;
        }
    
        [super removeFromParent];
    }
    

提交回复
热议问题