I have an app that stores user created JSON files successfully saving and loading to the local application documents directory. This directory is visible to the user. I would like to allow the user to upload them to iCloud in the ubiquity_container/Documents directory so that the files are synced to iCloud Drive.
My attempts to do this have failed and I think it's because I don't understand what the ubiquity container is. Is the iCloud Ubiquity container a folder? How do I save files into that ubiquity container/folder? Is saving to the ubiquity container separate from saving to to the application documents directory or does the application documents directory == the ubiquity container if I enable iCloud in the app?
I'm exploring this documentation Apple iCloud Documents
I have all entitlements correctly setup that I need to display the app documents directory in iCloud and locally so that the user can see them. This should work between devices on iOS and macOS (same container for both the mobile and desktop versions of the app.)
A high level view of what the ubiquity container is or is doing would be helpful. (For example, is it a folder or not; do you save files there instead of or in addition to the app documents directory; beyond the entitlements, do you need to do more in your code to save a file there or does the ubiquity container become the application documents directory, etc).
I would suggest to check these 2012 WWDC sessions:
237 - Advanced iCloud document storage
A high-level overview is available here.
In short, ubiquity container is a folder that allows you to coordinate its contents on reading and writing from multiple devices, and resolve the conflicts that such CRUD operations may produce.