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
902
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
665
May ’21
VPN lets internet disconnect
I made a VPN app with openVPN protocol, the problem is that in certain cases, for example when being on the plane, and if the VPN is enabled, it disconnects from the internet. To enable internet (cellular data) again we should turn the VPN off. The problem only appears when being on a plane or landing in a new country. Can anyone explain to me why this behavior? Thank you!
1
0
789
Apr ’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
902
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
7k
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
665
Activity
May ’21
Check if VPN configuration is installed on device - Swift
I am trying to find a way for checking if my VPN configuration is installed on my device from the app. I already tried to see the status, but it returns nil every time I close the app and reenter. Is there any other way to do it? My objective is to show a prompt before the VPN permission prompt shown by Apple. Thank you!
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’21
VPN lets internet disconnect
I made a VPN app with openVPN protocol, the problem is that in certain cases, for example when being on the plane, and if the VPN is enabled, it disconnects from the internet. To enable internet (cellular data) again we should turn the VPN off. The problem only appears when being on a plane or landing in a new country. Can anyone explain to me why this behavior? Thank you!
Replies
1
Boosts
0
Views
789
Activity
Apr ’21