Post

Replies

Boosts

Views

Activity

Allow only certain apps to use my VPN - Swift
I am making an app that activates a VPN connection based on OpenVPN, retrieves a certificate from the database, and opens a tunnel using NEPacketTunnelProvider and NetworkExtension. I used the following repository following repository, and now my VPN is working fine. But the problem is that I want to allow only one app to use this VPN when enabled (WhatsApp precisely), and I want to restrict all other apps of using it. On Android it's possible by giving the bundle identifier of the allowed apps to the PackageManager. Can you please help me? This is my PacketTunnelProvider class: PacketTunnelProvider class - https://developer.apple.com/forums/content/attachment/b1fa5a06-ad84-40ab-b92d-46198d3d404b This is the function used in my VPN View Model to start a tunnel: VPN View Model to start a tunnel - https://developer.apple.com/forums/content/attachment/689bef27-de9e-4e55-a0be-bf197942def9
3
0
3.1k
Feb ’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
667
Apr ’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!
0
0
580
May ’21
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
704
Feb ’22
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.4k
May ’22