iCloud Drive Folder

Hi everybody,


I have an iOS app that uses iCloud documents and iCloud drive. Does anyone know how to get the ubiquity folder to appear in the iCloud drive folder?


Thanks and regards,

Giordano

Replies

Good question. I just had to do this myself recently.


To see your app's folder in your iCloud Drive, you have to modify the Info.plist: Create an `NSUbiquitousContainers` dictionary. Within it, create a dictionary with the name of your ubiquity container. For example, `iCloud.com.yourcompany.yourapp`. Within it, create three keys: `NSUbiquitousContainerName`, a String, `NSUbiquitousContainerIsDocumentScopePublic`, a Boolean, and `NSUbiquitousContainerSupportedFolderLevels`, a String. The first of these three is the name of the folder. The second determines whether you will see your app's folder in iCloud Drive in, e.g., Finder on Mac. You'll want this value to be `YES`. The last determines whether the app's folder can have sub-folders. A value of `None` is accepted, meaning 'no,' but I don't recall the other accepted values.


N.B.: The changes to these keys will only take effect if your app's version increments; and incrementing the Build No. of your target is sufficient.


Also: The documentation suggests that only *used* containers appear 'publicly' in iCloud Drive, so a new empty container might not show up. I found this to be the case. When I saved a file to the `Documents` subdirectory of the ubiquitous container, only then did the app's directory appear in iCloud Drive.


R

I have been working on this, too. I have added the keys, upped the version number, located the ubiquity container, and wrote a test file there. I can loop through the files in the ubiquity container in my app (OSX) and the test file is there. However, I cannot see it in the iCloud Drive in the finder.

Additional information: On my Mac, I go to system settings, iCloud, iCloud Drive options. It lists apps that store docs there and my test app, iCloudTest, shows up there. (I wonder what the checkmarks do there)

However still, I don't see that folder in the finder for iCloud Drive.

I read somewhere that in order to see the app's iCloud Drive in Finder, the app's ubiquity container must have a `Documents` subdirectory. And perhaps a non-empty `Documents` subdirectory, initially.


R

My iphone app can write a file under "AppName" folder in iCloud Drive, but not able to write to "Documents" folder in iCloud.

If I use Finder in my MacBook to look at files in my iCloud Drive, only "Documents' folder can be seen, not "AppName" folder.

However, in my iphone, both "Document" and "AppName" folder can be seen.


Why I can't see "AppName" folder created by my iphone app using MacBook?

Is there any way to write file directly to Documents folder in iCloud Drive?

Here is where it is explained.

https://developer.apple.com/library/content/qa/qa1893/_index.html


The funny thing is, at least what I am experiencing, is that the folder and a file in it appear when I use the new iOS 11 Files app when I search for my app and I can see them, however that does not work when I search or look for them using the iCloud app on my Mac or online. What am I missing? Updating the Bundle version did allow it to write the file at least. But it is still not visible using the iCloud app on my Mac or online.

I had the same experience with only "used" containers appear 'publicly' in iCloud Drive. Only way I was able to make my container folder showed up in iCloud Drive was to create a temporary file on launch of my app. Question now is how do I make the container "used" for a new user without having to create a file.

what do you mean by "used" containers appear 'publicly'?

I had this same problem, can't solve, my app write file to iphone, but can't be seen on iCloud.com or Mac

Have you solved this issue? How?

Write to iCloud Drive has stopped working on all apps.

*** 1/3/2020 No longer works We believe the issue is "Unable to access iCloud Account, can't find Cloud URL" ***


A device update has made the URL to the iCloud Drive nil. How can we recover from this?


Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/ on line 295


Exp.

294 let containerURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)

295 let documentDirectoryURL = containerURL!.appendingPathComponent("Documents")

296 let documentURL = documentDirectoryURL.appendingPathComponent("myFile.txt")