Figured it out, leaving the answer here in case it is helpful to others.
When a CAAnimation
is removed (with the removeAllAnimations
call in the code above), it calls the delegate's animationDidStop:finished:
method to tell the delegate that the animation has been interrupted. (Interestingly, it does so even if you set the CALayer's
delegate to nil when removing the animations).
So you can't removeAllAnimations
and release the object at the same time. Instead, I suppose the animationDidStop:finished:
method will have to have some method of detecting whether it should process as normal or not.