Skip to content

Commit

Permalink
Merge pull request pichillilorenzo#12 from brian-lin/TWECACAPP-651_fi…
Browse files Browse the repository at this point in the history
…x_crash_that_runJavaScriptAlertPanelWithMessage_is_called_while_App_in_the_background

TWECACAPP-651 fix crash that runJavaScriptAlertPanelWithMessage is called while App in the background
  • Loading branch information
eJamesLin authored and GitHub Enterprise committed Jun 18, 2020
2 parents 5c7758e + 149f736 commit a053f4f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ios/Classes/InAppWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1863,9 +1863,12 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
alertController.addAction(UIAlertAction(title: okButton, style: UIAlertAction.Style.default) {
_ in completionHandler()}
);

let presentingViewController = ((self.IABController != nil) ? self.IABController! : self.window!.rootViewController!)
presentingViewController.present(alertController, animated: true, completion: {})

if let presentingViewController = self.IABController ?? self.window?.rootViewController {
presentingViewController.present(alertController, animated: true, completion: {})
} else {
completionHandler()
}
}

public func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String,
Expand Down

0 comments on commit a053f4f

Please sign in to comment.