You can change the dynamic
property back and forth, however, you should be very careful if you're using collision/contact detection.
During collision/contact between two bodies, it is asserted that at least one of them must be a dynamic body. If you change that property to NO at runtime, and the other contacted body is also static (non-dynamic), and the collision/contact callback is happening, it will throw this particular assertion error - contact will be detected between 2 static bodies mid-execution, which Box2d doesn't enjoy.
A possible workaround trick - works for me, even directly in the didBeginContact:
method:
SKPhysicsBody *temp = node.physicsBody;
temp.dynamic = NO;
node.physicsBody = temp;