Opening public iOS files using a Delphi FMX app

  

I am developing a document viewer app that should be able to handle a custom file type. I already managed to resister my app as default handler for the file type using CFBundleDocumentTypes in my info.plist.
This enables me to choose a file from the explorer and open it in my app using the "copy to…" feature in the sharing options of the file.
The behavior of that feature isn’t ideal for me, as it is not very intuitive for new users.
Also the files are (as the name already said) always copied to the internal Directory of my App, which changes their names and wastes a lot of space when opening the same file multiple times.
Adding LSSupportsOpeningDocumentsInPlace to the info.plist changes "copy to.." to be "open in…" which is also triggered by just tappin the file. On the iOS side this is exactly what I want, but now the URL my App receives is security scoped meaning I can’t just access the File like one of my own.
The Apple Developer Documentation suggests either requesting Access by using startAccessingSecurityScopedResource() or by using the UIDocument class.
Both of which don’t seem to work, I can’t find any implementation of startAccessingSecurityScopedResource() in the iOSAPI and UIDocument needs a NSUrl which I can’t create from the String "Url" which I get passed on when opening the App, since it is security scoped and can’t be accessed.

Is there any other way to gain Access to security scoped Resources using Delphi or did I maybe miss something when looking through the iOSAPI?
I am using the following Versions:
Delphi 10.4 Sydney Patch 3
Platform Assistant Server 21.0
macOS Catalina 10.15.6
Xcode 11.7
iPhone 7 with iOS 13.7

Comments are closed.