- The app's container is public, so it is visible in iCloud Drive.
- The app displays files in its public iCloud container.
- The app can I also present the
UIDocumentPickerViewController
withUIDocumentPickerModeImport
mode so users can import files from other containers.
But I do not want users to be able to import files from the app's own container. These are already visible in the app using NSMetadataQuery
.
How can I prevent this?
- The container must be public so it is visible from iCloud Drive on the desktop. So hiding it is not an option.
- I could use
UIDocumentPickerModeOpen
instead, because then I can examine the fileURL and see that the selected item is within the app's container. - I was hoping I could create an
NSMetadataQuery
from the url given by theUIDocumentPickerViewController
and then check theNSMetadataUbiquitousItemIsExternalDocumentKey
attribute. But I haven't managed to do that.