Repository: incubator-weex Updated Branches: refs/heads/master 85e659aa0 -> 7b5f09edc
* [iOS] add try catch exception capturing the exception during the progress of removing gesture targets Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7b5f09ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7b5f09ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7b5f09ed Branch: refs/heads/master Commit: 7b5f09edce4da7b1c53b20db56c4f7c77df3d27d Parents: 85e659a Author: acton393 <[email protected]> Authored: Mon Mar 26 11:25:41 2018 +0800 Committer: acton393 <[email protected]> Committed: Mon Mar 26 11:25:41 2018 +0800 ---------------------------------------------------------------------- .../WeexSDK/Sources/Events/WXComponent+Events.m | 42 +++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7b5f09ed/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m index 621df21..2ea93d9 100644 --- a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m +++ b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m @@ -310,7 +310,13 @@ if ([removeEventName isEqualToString:@#eventName]) {\ [self.view removeGestureRecognizer:_tapGesture]; } } - [_tapGesture removeTarget:self action:@selector(onClick:)]; + @try { + [_tapGesture removeTarget:self action:@selector(onClick:)]; + }@catch(NSException *exception) { + WXLog(@"%@", exception); + } @finally { + + } _tapGesture = nil; } } @@ -380,14 +386,20 @@ if ([removeEventName isEqualToString:@#eventName]) {\ return; } - for (UISwipeGestureRecognizer *recognizer in _swipeGestures) { - recognizer.delegate = nil; - if([self isViewLoaded]) { - if ([[self.view gestureRecognizers] containsObject:recognizer]) { - [self.view removeGestureRecognizer:recognizer]; + @try { + for (UISwipeGestureRecognizer *recognizer in _swipeGestures) { + recognizer.delegate = nil; + if([self isViewLoaded]) { + if ([[self.view gestureRecognizers] containsObject:recognizer]) { + [self.view removeGestureRecognizer:recognizer]; + } } + [recognizer removeTarget:self action:@selector(onSwipe:)]; } - [recognizer removeTarget:self action:@selector(onSwipe:)]; + }@catch(NSException *exception) { + WXLog(@"%@", exception); + }@finally { + } _swipeGestures = nil; } @@ -445,7 +457,13 @@ if ([removeEventName isEqualToString:@#eventName]) {\ [self.view removeGestureRecognizer:_longPressGesture]; } } - [_longPressGesture removeTarget:self action:@selector(onLongPress:)]; + @try { + [_longPressGesture removeTarget:self action:@selector(onLongPress:)]; + }@catch(NSException * exception) { + WXLog(@"%@", exception); + }@finally { + + } _longPressGesture = nil; } } @@ -599,7 +617,13 @@ if ([removeEventName isEqualToString:@#eventName]) {\ } _panGesture.delegate = nil; - [_panGesture removeTarget:self action:@selector(onPan:)]; + @try { + [_panGesture removeTarget:self action:@selector(onPan:)]; + }@catch(NSException * exception) { + WXLog(@"%@", exception); + }@finally { + + } _panGesture = nil; } }
