I am trying to add iCloud drive capabilities to my existing iPhone app, basically just to be able to store files in iCloud drive, such that the user has access to them on all his devices.
I have followed the steps to enable iCloud drive capabilities:
- Enable iCloud Documents capability in the "Signing and Capabilities" in XCode for the project target, and the iCloud container
- Added the
NSUbiquitousContainers
key to theInfo.plist
. - The app ensures the
Documents
folder in the ubiquity container exists - The app writes a test file into the
Documents
folder at start-up. - Stepped the build version to a higher number
So far, it is working locally on the iPhone: the app folder is visible in the Files
app on the same phone, and the test file is visible there as well.
But the app folder is not visible on iCloud.com, and not in Finder on my MacBook. I can see the Downloads
folder with the same content in iCloud Drive on both platforms, so I am sure that I am logged in with the same AppleID as on the iPhone.
What else do I need to do to make the app folder visible in iCloud? If it is an issue because the app update has not been released yet, how can I test the functionality before releasing it?
I have looked at other questions that have encountered the same problems, such as this and this, but I think I have done all the steps recommended in those answers (the practical ones, requesting a new AppID is obviously not possible for an existing app).
The Apple documentation is extremely bloated, so it is hard to distill what the basic steps are that you need to follow.
Info.plist settings (obviously with MyApp
replaced with my app's name):
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.MyApp.MyApp</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>MyApp</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>