cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Li, Jonathan" <>
Subject Ios cordova app randomly got frozen after dismissing inappbrowser
Date Fri, 10 Mar 2017 19:00:02 GMT

During the recent testing of our ios cordova applications, we got an issue of the app’s
main UIwebview UI freezing after dismissing the inappbrowser. Debugging shows somehow the
UIWindow created by inappbrowser did not deallocated as expected after calling the close method
to dismiss the inappbrowser. So although the inappbrowser’s UIWindows is invisiable, but
it is still the keywindow and receive the user input. The xcode instrument shows there is
only one reference on the inappbrowser’s UIWindow object , which is expected to be released
after dismissing the inappbrowser viewcontroller. Although this part of logic is inside the
Apple SDK, and not sure exactly when the UIWindow is released within the Apple SDK. Note this
happens randomly, so it may be a timing related issue.

Just wonder whether anyone else has seen the similar issue? Or have any idea about it. Both
main webview and inappbrwoser webview use UIWebView to show the html content. WKWebview is
not involved.

For now, we added an if condition in the show method in dispatch_async block in our inappbrowser.m
to work around the issue, but if others see the same thing, we will need to have a pull request
for this change.

- (void)show:(CDVInvokedUrlCommand*)command

    // Run later to avoid the "took a long time" log message.
    dispatch_async(dispatch_get_main_queue(), ^{
        if (weakSelf.inAppBrowserViewController != nil) {
            if ([weakSelf.inAppBrowserViewController.webView isKindOfClass:[WKWebView class]])
				CGRect frame = [[UIScreen mainScreen] bounds];
				UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
				UIViewController *tmpController = [[UIViewController alloc] init];
				[tmpWindow setRootViewController:tmpController];
				[tmpWindow setWindowLevel:UIWindowLevelNormal];

				[tmpWindow makeKeyAndVisible];
				[tmpController presentViewController:nav animated:YES completion:nil];
            else {
  [weakSelf.viewController presentViewController:nav animated:YES completion:nil];


View raw message