So I’ve got a sampling plugin that is multi-platform and sandboxed on both Mac and iOS.
I’m trying to get my app to use preset files that contain both XML metadata and wave files. This is a challenge because of sandboxing limitations. When a user opens a file, the OS only elevates privileges for the file the user clicked on in the Open dialog box. Any sidecar files, such as WAVE files referenced from my main XML files, can’t be loaded. But there’s light at the end of the tunnel: I’ve defined a document package type which is, of course, just a directory that the OS (be it iOS or macOS) chooses to display as though it were an individual file.
Everything works well with this system on Mac because on the Mac I can use the File class to simply look at the files which are contained within the document package (which is of course just a directory). The problem is that on iOS, I want to make use of iCloud Drive. Traditionally, the answer given for how to open files on iCloud from within a sandboxed app is to grab the URL of the file selected by the user, and use that URL to create an InputStream. For whatever reason, this seems to work well on iOS and it maintained the security scoped privileges, etc. The problem is that a document package is not a file–it’s actually a directory. The URL that comes back from the File chooser dialog is something like this: “file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Decent%20Sampler/Ukelin.dsbundle/”
How can I open document package from within my sandboxed iOS and have access to the files contained within the document package?