diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 02aa80d..fdc88dc 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -80,6 +80,11 @@ static CDVWKInAppBrowser* instance = nil; NSLog(@"IAB.close() called but it was already closed."); return; } + + // Set tmpWindow to hidden to make main webview responsive to touch again + // https://stackoverflow.com/questions/4544489/how-to-remove-a-uiwindow + self->tmpWindow.hidden = YES; + // Things are cleaned up in browserExit. [self.inAppBrowserViewController close]; } @@ -314,17 +319,18 @@ static CDVWKInAppBrowser* instance = nil; dispatch_async(dispatch_get_main_queue(), ^{ if (weakSelf.inAppBrowserViewController != nil) { float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; - if (!self->tmpWindow) { + __strong __typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf->tmpWindow) { CGRect frame = [[UIScreen mainScreen] bounds]; if(initHidden && osVersion < 11){ frame.origin.x = -10000; } - self->tmpWindow = [[UIWindow alloc] initWithFrame:frame]; + strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame]; } UIViewController *tmpController = [[UIViewController alloc] init]; - [self->tmpWindow setRootViewController:tmpController]; - [self->tmpWindow setWindowLevel:UIWindowLevelNormal]; + [strongSelf->tmpWindow setRootViewController:tmpController]; + [strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal]; if(!initHidden || osVersion < 11){ [self->tmpWindow makeKeyAndVisible];