Our app is a document-based app that uses UIDocumentBrowserViewController. We are facing an issue when the user is creating a new document on iOS/iPadOS when in the “Recents” tab (as opposed to the “Browse” tab). Specifically, the document is saved to a hidden ubiquity container. As a result, the user cannot find the file in the document browser. It also does not appear in “Recents”. The expected behaviour would be a folder with our app's icon on it on the user’s iCloud Drive, which contains the files the user creates when in the “Recents” tab.
This issue started to happen when we introduced a new feature that uses iCloud Documents with its own ubiquity container. I'm not sure how UIDocumentBrowserViewController handled saving documents to a default location on iCloud Drive before we had the iCloud Documents entitlement enabled. All I know is that there were no issues.
How to recreate the issue:
Create a document-based app with UIDocumentBrowserViewController. Run the app and create a document while in the recents tab with iCloud enabled. The document will be stored to a folder on iCloud.
Now, enable iCloud Documents and specify a ubiquity container. Then, try to create documents in the Recents tab. The location in which the documents are created cannot be navigated to.
"The document will be stored to a folder on iCloud."
If you don't do anything special, the document will by default be in the Documents
folder in your app's sandbox, which is your app's folder under the "On My iPhone" location.
Now, enable iCloud Documents and specify a ubiquity container. Then, try to create documents in the Recents tab. The location in which the documents are created cannot be navigated to.
Did you try to expose your ubiquity container to iCloud Drive yet? If not, please follow the Publish an iCloud Container to iCloud Drive section of the Synchronizing Documents in the iCloud Environment sample to do so. After that, your ubiquity container should show up as a folder under iCloud Drive, and you might be able to find the file from there.
Note that the steps listed in the section needs to be strictly followed, especially step 2 – If you don't increase the bundle version, the system may not refresh the metadata immediately, and so the folder may not show up.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.