Fix crash on iOS when reloading page from remote Safari

This closes #110
This commit is contained in:
Franco Bugnano 2016-07-21 17:14:42 +02:00 committed by Julio César
parent d65c0c7cc5
commit 0a8b5be3d1

View File

@ -142,9 +142,17 @@
_curImageName = nil; _curImageName = nil;
self.viewController.view.userInteractionEnabled = YES; // re-enable user interaction upon completion self.viewController.view.userInteractionEnabled = YES; // re-enable user interaction upon completion
@try {
[self.viewController.view removeObserver:self forKeyPath:@"frame"]; [self.viewController.view removeObserver:self forKeyPath:@"frame"];
[self.viewController.view removeObserver:self forKeyPath:@"bounds"]; [self.viewController.view removeObserver:self forKeyPath:@"bounds"];
} }
@catch (NSException *exception) {
// When reloading the page from a remotely connected Safari, there
// are no observers, so the removeObserver method throws an exception,
// that we can safely ignore.
// Alternatively we can check whether there are observers before calling removeObserver
}
}
- (CDV_iOSDevice) getCurrentDevice - (CDV_iOSDevice) getCurrentDevice
{ {