Post

Replies

Boosts

Views

Activity

this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a t
I am trying to distribute an XCFramework through a local Swift Package. I have installed the same XCFramework on my Target through Pod and it works fine but When I moved it into a Swift Package, I get the error above. I have also changed the version of Swift in my package but the error persists. // swift-tools-version: 5.7.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "SmileIDentity", platforms: [.iOS(.v16)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "SmileIDentity", targets: ["SmileIDentity", "Smile_Identity_SDK"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), ], targets: [ .target( name: "SmileIDentity", dependencies: []), .binaryTarget(name: "Smile_Identity_SDK", path: "./Smile_Identity_SDK.xcframework"), .testTarget( name: "SmileIDentityTests", dependencies: ["SmileIDentity"]), ] )
3
0
4.6k
Mar ’23
Access denied (Error code 1020) on WKWebView
This is most likely a new question as I have not seen any other question related. I am trying to connect to a cybersource payment endpoint using WKWebview on SwiftUI I get the error I have tried to set cookie but still won't work WebView public struct HTMLView: UIViewRepresentable { var url: String var javascriptString: String @Binding var webViewUIModel: UIModel public init(url: String, javascriptString: String = "", webViewUIModel: Binding<UIModel>) { self.url = url self.javascriptString = javascriptString self._webViewUIModel = webViewUIModel } public func makeUIView(context: Context) -> WKWebView { // let webView = WKWebView() let webConfiguration = WKWebViewConfiguration() let store = WKWebsiteDataStore.default() webConfiguration.websiteDataStore = store webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true webConfiguration.defaultWebpagePreferences.allowsContentJavaScript = true let webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.navigationDelegate = context.coordinator webView.loadHTMLString(url, baseURL: nil) return webView } public func updateUIView(_ uiView: WKWebView, context: Context) { uiView.loadHTMLString(url, baseURL: nil) } public func makeCoordinator() -> WebViewCordinator { .init(javascriptString: javascriptString) { print("HTMLView: Start") } didHaveError: { e in print("HTMLView: Error") } didFinish: { print("HTMLView: Finish") } } } Cordinator public class WebViewCordinator: NSObject, WKNavigationDelegate, WKUIDelegate { var javascriptString: String var didStart: () -> Void var didHaveError: (Error) -> Void var didFinish: () -> Void public init(javascriptString: String = "", didStart: @escaping () -> Void, didHaveError: @escaping (Error) -> Void, didFinish: @escaping () -> Void) { self.javascriptString = javascriptString self.didStart = didStart self.didHaveError = didHaveError self.didFinish = didFinish } public func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { guard let response = navigationResponse.response as? HTTPURLResponse, let url = navigationResponse.response.url else { decisionHandler(.cancel) return } if let headerFields = response.allHeaderFields as? [String: String] { let cookies = HTTPCookie.cookies(withResponseHeaderFields: headerFields, for: url) cookies.forEach { cookie in print("Cookie \(cookie) \(cookie.domain)") webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie) } } decisionHandler(.allow) } public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { print("Error \(error)") didHaveError(error) } public func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { print("HTMLViewCOMMIT \( webView.url)") } public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { print( "HTMLViewFINISH \( String(describing: webView.url))") webView.evaluateJavaScript("document.body.innerHTML") { value, error in print("HTMLFinishValue \(value)") print("Errot\(error)") } didFinish() } } How can I resolve this?
0
0
710
Feb ’23
Handle connection with error: Connection interrupted
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?
0
1
760
Feb ’23