You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Shazron <sh...@gmail.com> on 2017/03/11 02:28:47 UTC

Re: Ios cordova app randomly got frozen after dismissing inappbrowser

Which version of InAppBrowser was installed?

Sounds like a good idea to add the conditional since that fix was added for
WKWebView:
https://github.com/apache/cordova-plugin-inappbrowser/commit/f32917df314f08296c53a4de0255a424be773184

Let me know what you need to get that PR going.


On Fri, Mar 10, 2017 at 11:00 AM, Li, Jonathan <jo...@sap.com> wrote:

> Hi,
>
> 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];
>             }
>         }
>     });
> }
>
> Thanks
> Jonathan
>
>