Reputation: 387
I am getting "Multiple gravity behaviour per animator is undefined and may assert in the future" in debugger. I think it is because i use custom [SASlideMenu view controller] (https://github.com/stefanoa/SASlideMenu). What is it?
Upvotes: 1
Views: 806
Reputation: 334
Look for the code where UIGravityBehavior
objects are created and added to the UIDynamicAnimator
instance. It seems behaviors are accumulating in the animator (and not being released when completing the action).
This project has the same issue https://github.com/simonwhitaker/ioscon-2014-demo. It can be solved using - (void)removeBehavior:(UIDynamicBehavior *)behavior
:
- (IBAction)dismissAlertView:(id)sender {
UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.alertView]];
gravity.magnitude = 4;
__weak __typeof(self) weakSelf = self;
__weak __typeof__(gravity) weakGravity = gravity;
gravity.action = ^{
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!CGRectIntersectsRect(strongSelf.alertView.frame, strongSelf.alertBackgroundView.bounds)) {
//[strongSelf.animator removeAllBehaviors];
[strongSelf.animator removeBehavior:weakGravity];
[UIView animateWithDuration:0.1 animations:^{
strongSelf.alertBackgroundView.alpha = 0.0;
}];
}
};
[self.animator addBehavior:gravity];
}
Upvotes: 1