fix crash
fix crash by removing observer when operation finished
This commit is contained in:
parent
05068ec879
commit
234143a416
@ -17,6 +17,7 @@
|
||||
@interface MVMCoreNavigationOperation ()
|
||||
|
||||
@property (strong, nonatomic) MVMCoreNavigationObject *navigationObject;
|
||||
@property (strong, nonatomic) id animatedTransitioning;
|
||||
|
||||
@end
|
||||
|
||||
@ -217,6 +218,10 @@
|
||||
[[MVMCoreLoadingOverlayHandler sharedLoadingOverlay] stopLoading:YES];
|
||||
self.navigationObject.stopLoadingOverlay = NO;
|
||||
}
|
||||
if (self.animatedTransitioning) {
|
||||
[self.animatedTransitioning removeObserver:self forKeyPath:@"interactiveTransitionCanceled"];
|
||||
self.animatedTransitioning = nil;
|
||||
}
|
||||
[super markAsFinished];
|
||||
}
|
||||
|
||||
@ -244,6 +249,7 @@
|
||||
id animatedTransitioning = [self.delegate navigationController:navigationController animationControllerForOperation:operation fromViewController:fromVC toViewController:toVC];
|
||||
if ([animatedTransitioning conformsToProtocol:@protocol(MVMCoreViewControllerAnimatedTransitioning)]) {
|
||||
[animatedTransitioning addObserver:self forKeyPath:@"interactiveTransitionCanceled" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
|
||||
self.animatedTransitioning = animatedTransitioning;
|
||||
}
|
||||
return animatedTransitioning;
|
||||
} else {
|
||||
@ -261,7 +267,6 @@
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
|
||||
if ([keyPath isEqualToString:@"interactiveTransitionCanceled"]) {
|
||||
[object removeObserver:self forKeyPath:@"interactiveTransitionCanceled"];
|
||||
BOOL transitionCanceled = ((NSNumber *)change[NSKeyValueChangeNewKey]).boolValue;
|
||||
if (transitionCanceled) {
|
||||
//When interactive transition canceled, the destination viewController should be removed from navigationController
|
||||
|
||||
Loading…
Reference in New Issue
Block a user