Post

Replies

Boosts

Views

Activity

WKWebView: Error when loading file from memory - SwiftUI
I am trying to load a file from memory and preview it in a WebView in SwiftUI. I already made the same procedure in Swift and it's working, but it's not working in SwiftUI. Files and successfully save to memory and retrieved, but I am getting this error: WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=NSPOSIXErrorDomain, code=1, isMainFrame=1 This function will return the WebView private func createURL() -> AnyView{ DocumentManager.shared.save(text: "Hey dear", toDirectory: DocumentManager.shared.documentDirectory(), withFileName: "test345.docx") let fileURL = DocumentManager.shared.read(fromDocumentsWithFileName: "test345.docx") return AnyView(Webview(url: URL(fileURLWithPath: fileURL))) } This is my UIViewRepresentable: struct Webview: UIViewRepresentable { let url: URL let navigationHelper = WebViewHelper() func makeUIView(context: UIViewRepresentableContext<Webview>) -> WKWebView { let webview = WKWebView() webview.navigationDelegate = navigationHelper let request = NSURLRequest(url: url as URL) as URLRequest webview.load(request) return webview } func updateUIView(_ webview: WKWebView, context: UIViewRepresentableContext<Webview>) { let request = URLRequest(url: self.url, cachePolicy: .returnCacheDataElseLoad) webview.load(request) } } And this is my WebView helper class: class WebViewHelper: NSObject, WKNavigationDelegate { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { print("webview didFinishNavigation") } func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { print("didStartProvisionalNavigation") } func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { print("webviewDidCommit") } func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { print("didReceiveAuthenticationChallenge") completionHandler(.performDefaultHandling, nil) } }
0
0
1.7k
May ’22
Unable to push or pull
I committed some changes in my Xcode project and tried to push them, but I am prompted with: "The local repository is out of date." Then I tried to pull as they said, but then I am prompted with: "The working copy has conflicting, uncommitted changes." I really need to commit these changes, and I am scared of losing them if I do any wrong step. What should I do? Thanks
0
0
914
Feb ’22
In-app purchases background problem
I implemented in-app purchases in my app that is sending the receipt with the user ID (that I get from Memory) to the backend before finishing the transaction. In Sandbox and TestFlight, the in-app purchase is working fine. But the problem is that when I am in production, the user ID received at the backend is nil. Is it possible that the in-app purchase is killing every background process, so that's why I am unable to get the user ID from the memory? And do you have any idea how I can solve this issue? Thanks!
0
0
678
May ’21
WKWebView: Error when loading file from memory - SwiftUI
I am trying to load a file from memory and preview it in a WebView in SwiftUI. I already made the same procedure in Swift and it's working, but it's not working in SwiftUI. Files and successfully save to memory and retrieved, but I am getting this error: WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=NSPOSIXErrorDomain, code=1, isMainFrame=1 This function will return the WebView private func createURL() -> AnyView{ DocumentManager.shared.save(text: "Hey dear", toDirectory: DocumentManager.shared.documentDirectory(), withFileName: "test345.docx") let fileURL = DocumentManager.shared.read(fromDocumentsWithFileName: "test345.docx") return AnyView(Webview(url: URL(fileURLWithPath: fileURL))) } This is my UIViewRepresentable: struct Webview: UIViewRepresentable { let url: URL let navigationHelper = WebViewHelper() func makeUIView(context: UIViewRepresentableContext<Webview>) -> WKWebView { let webview = WKWebView() webview.navigationDelegate = navigationHelper let request = NSURLRequest(url: url as URL) as URLRequest webview.load(request) return webview } func updateUIView(_ webview: WKWebView, context: UIViewRepresentableContext<Webview>) { let request = URLRequest(url: self.url, cachePolicy: .returnCacheDataElseLoad) webview.load(request) } } And this is my WebView helper class: class WebViewHelper: NSObject, WKNavigationDelegate { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { print("webview didFinishNavigation") } func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { print("didStartProvisionalNavigation") } func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { print("webviewDidCommit") } func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { print("didReceiveAuthenticationChallenge") completionHandler(.performDefaultHandling, nil) } }
Replies
0
Boosts
0
Views
1.7k
Activity
May ’22
Unable to push or pull
I committed some changes in my Xcode project and tried to push them, but I am prompted with: "The local repository is out of date." Then I tried to pull as they said, but then I am prompted with: "The working copy has conflicting, uncommitted changes." I really need to commit these changes, and I am scared of losing them if I do any wrong step. What should I do? Thanks
Replies
0
Boosts
0
Views
914
Activity
Feb ’22
App not showing in AppStore Connect
Hello, I am not new to AppStore connect, and I am uploading a new build of my app, after the upload, it says "successfully uploaded", but then nothing appears in AppStore Connect, and I am not getting any email from Apple in case something is wrong. I tried a second time with a new build number, same problem. Please help me, it's urgent
Replies
2
Boosts
0
Views
7.1k
Activity
Jun ’21
In-app purchases background problem
I implemented in-app purchases in my app that is sending the receipt with the user ID (that I get from Memory) to the backend before finishing the transaction. In Sandbox and TestFlight, the in-app purchase is working fine. But the problem is that when I am in production, the user ID received at the backend is nil. Is it possible that the in-app purchase is killing every background process, so that's why I am unable to get the user ID from the memory? And do you have any idea how I can solve this issue? Thanks!
Replies
0
Boosts
0
Views
678
Activity
May ’21