I get crash reports that appear from a UIView animation, invoking a delegate that has been canceled.
Thread 0 Crashed: 0 libobjc.A.dylib 0x334776f6 objc_msgSend + 18 1 UIKit 0x31c566c4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] 2 UIKit 0x31c565d2 -[UIViewAnimationState animationDidStop:finished:] 3 QuartzCore 0x30045a26 run_animation_callbacks
I set the current view controller as a delegate for animations using the following template:
[UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; ... [UIView commitAnimations];
My question is how to set this delegate link to nil in my dealloc method? Is there a way to keep the link to the animation? Or get animation in progress?
Dougw source share