I'm using Xcode 11.5 and loading a web page in a WKWebView. I have file access set to read only and this is my apps capability list.
This is how my loadView look like
override func loadView() {
//Inject JS string to read console.logs for debugging
let configuration = WKWebViewConfiguration()
let action = "var originalCL = console.log; console.log = function(msg){ originalCL(msg); window.webkit.messageHandlers.iosListener.postMessage(msg); }" //Run original console.log function + print it in Xcode console
let script = WKUserScript(source: action, injectionTime: .atDocumentStart, forMainFrameOnly: false) //Inject script at the start of the document
configuration.userContentController.addUserScript(script)
configuration.userContentController.add(self, name: "iosListener")
//Initialize WKWebView
webView = WebView(frame: (NSScreen.main?.frame)!, configuration: configuration)
//Set delegates and load view in the window
webView.navigationDelegate = self
webView.uiDelegate = self
view = webView
}
When I use Safari on iOS and I tab the input type=file the dialog opens up but using my macOS app using a webview it does not work? Do I need to set more capabilities on my app? I found some old issues with file inputs but they seem to be resolved?
