Another error that comes with the one in title is interruptionHandler is called. -[FontServicesDaemonManager connection]_block_invoke
Also I get the error This method should not be called on the main thread as it may lead to UI unresponsiveness.
I am sending a POST request via the WKWebview which redirects to another url for validation.
This has been a bottle neck for a week but could not find a solution. Here is my Webview
public struct WebView: UIViewRepresentable {
let url: URL?
let urlRequest: URLRequest?
@Binding var webViewUIModel: UIModel
public init(url: URL? = nil, urlRequest: URLRequest? = nil, webViewUIModel: Binding<UIModel>) {
self.url = url
self.urlRequest = urlRequest
self._webViewUIModel = webViewUIModel
}
public func makeUIView(context: Context) -> WKWebView {
let webConfiguration = WKWebViewConfiguration()
webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true
webConfiguration.defaultWebpagePreferences.allowsContentJavaScript = true
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
webView.navigationDelegate = context.coordinator
if let request = urlRequest {
webView.load(request)
} else {
let request = URLRequest(url: url!)
webView.load(request)
}
return webView
}
public func updateUIView(_ uiView: WKWebView, context: Context) {
if let request = urlRequest {
uiView.load(request)
} else {
let request = URLRequest(url: url!)
uiView.load(request)
}
}
public func makeCoordinator() -> WebViewCordinator {
.init(javascriptString: "") {
print("WebView: Start")
} didHaveError: { e in
print("WebView: Error")
} didFinish: {
print("WebView: Finish")
}
}
}
What am I doing wrong?