Ok, a few things here...
First of all, to be able to open directly files from the File app, I had to add to the info.plist UISupportsDocumentBrowser YES.
When running from the simulator, all files were passed to my application though
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { ... }
but as soon as I added the UISupportsDocumentBrowser YES. now I fell back to the regular way of launching an app from a file which is
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
...
// a file was passed through its url
if let url = connectionOptions.urlContexts.first?.url {
// do whatever you need to do with this file, but use startAccessingSecurityScopedResource()
}
}
Now it works. I hope it will help others :-)
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: