diff --git a/flutter_inappwebview/CHANGELOG.md b/flutter_inappwebview/CHANGELOG.md
index 87981c91..dbe70ff0 100755
--- a/flutter_inappwebview/CHANGELOG.md
+++ b/flutter_inappwebview/CHANGELOG.md
@@ -2,6 +2,7 @@
- Updated minimum platform interface and implementation versions
- Fix typos and other code improvements (thanks to [michalsrutek](https://github.com/michalsrutek))
+- Fixed "runtime issue of SecTrustCopyExceptions 'This method should not be called on the main thread as it may lead to UI unresponsiveness.' when using onReceivedServerTrustAuthRequest" [#1924](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1924)
- Merged "💥 Fix iPad crash due to missing sourceView" [#1933](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1933) (thanks to [michalsrutek](https://github.com/michalsrutek))
- Merged "💥 Fix crash - remove force unwrapping from dispose method" [#1932](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1932) (thanks to [michalsrutek](https://github.com/michalsrutek))
diff --git a/flutter_inappwebview/example/ios/Runner/Info.plist b/flutter_inappwebview/example/ios/Runner/Info.plist
index a5b02ad4..2f4e465c 100755
--- a/flutter_inappwebview/example/ios/Runner/Info.plist
+++ b/flutter_inappwebview/example/ios/Runner/Info.plist
@@ -56,6 +56,7 @@
UIBackgroundModes
fetch
+ processing
remote-notification
UILaunchStoryboardName
diff --git a/flutter_inappwebview_ios/CHANGELOG.md b/flutter_inappwebview_ios/CHANGELOG.md
index d7659fd3..67a9a33b 100644
--- a/flutter_inappwebview_ios/CHANGELOG.md
+++ b/flutter_inappwebview_ios/CHANGELOG.md
@@ -2,6 +2,7 @@
- Updated `flutter_inappwebview_platform_interface` version dependency to `^1.0.9`
- Fix typos and other code improvements (thanks to [michalsrutek](https://github.com/michalsrutek))
+- Fixed "runtime issue of SecTrustCopyExceptions 'This method should not be called on the main thread as it may lead to UI unresponsiveness.' when using onReceivedServerTrustAuthRequest" [#1924](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1924)
- Merged "💥 Fix iPad crash due to missing sourceView" [#1933](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1933) (thanks to [michalsrutek](https://github.com/michalsrutek))
- Merged "💥 Fix crash - remove force unwrapping from dispose method" [#1932](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1932) (thanks to [michalsrutek](https://github.com/michalsrutek))
diff --git a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift
index a2aca5a3..25dee18d 100755
--- a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift
+++ b/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift
@@ -2079,10 +2079,13 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
completionHandler(.cancelAuthenticationChallenge, nil)
break
case 1:
- let exceptions = SecTrustCopyExceptions(serverTrust)
- SecTrustSetExceptions(serverTrust, exceptions)
- let credential = URLCredential(trust: serverTrust)
- completionHandler(.useCredential, credential)
+ // workaround for https://github.com/pichillilorenzo/flutter_inappwebview/issues/1924
+ DispatchQueue.global(qos: .background).async {
+ let exceptions = SecTrustCopyExceptions(serverTrust)
+ SecTrustSetExceptions(serverTrust, exceptions)
+ let credential = URLCredential(trust: serverTrust)
+ completionHandler(.useCredential, credential)
+ }
break
default:
InAppWebView.credentialsProposed = []
diff --git a/flutter_inappwebview_macos/CHANGELOG.md b/flutter_inappwebview_macos/CHANGELOG.md
index 81e9d97e..4acbce79 100644
--- a/flutter_inappwebview_macos/CHANGELOG.md
+++ b/flutter_inappwebview_macos/CHANGELOG.md
@@ -2,6 +2,7 @@
- Updated `flutter_inappwebview_platform_interface` version dependency to `^1.0.9`
- Fix typos and other code improvements (thanks to [michalsrutek](https://github.com/michalsrutek))
+- Fixed "runtime issue of SecTrustCopyExceptions 'This method should not be called on the main thread as it may lead to UI unresponsiveness.' when using onReceivedServerTrustAuthRequest" [#1924](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1924)
## 1.0.9
diff --git a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift
index d6aed683..2ec0c7aa 100755
--- a/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift
+++ b/flutter_inappwebview_macos/macos/Classes/InAppWebView/InAppWebView.swift
@@ -1462,10 +1462,13 @@ public class InAppWebView: WKWebView, WKUIDelegate,
completionHandler(.cancelAuthenticationChallenge, nil)
break
case 1:
- let exceptions = SecTrustCopyExceptions(serverTrust)
- SecTrustSetExceptions(serverTrust, exceptions)
- let credential = URLCredential(trust: serverTrust)
- completionHandler(.useCredential, credential)
+ // workaround for https://github.com/pichillilorenzo/flutter_inappwebview/issues/1924
+ DispatchQueue.global(qos: .background).async {
+ let exceptions = SecTrustCopyExceptions(serverTrust)
+ SecTrustSetExceptions(serverTrust, exceptions)
+ let credential = URLCredential(trust: serverTrust)
+ completionHandler(.useCredential, credential)
+ }
break
default:
InAppWebView.credentialsProposed = []