Why is my iCloud Drive AppFolder visible on MacOS, but disabled in iCloud Drive App on iOS?
Asked Answered
N

2

9

I developed an iCloud Drive Export feature for my iOS App and it works. I can see the exported Documents in our public AppContainerFolder in the iCloud Drive folder on Mac OS X 10.11.

But on iOS, I only can see the AppContainerFolder in the iCloud Drive app. It is disabled and I am not able to open that folder, or see the documents inside.

Image of the disable folder in the iOS iCloud Drive App

From the iCloud Drive settings, I can see that the files I have exported are in that AppContainerFolder in iCloud Drive.

Image of the AppContainerFolder inside the iCloud settings

Has anyone had such an issue with iCloud Drive?

I am using two app containers in my app, one with the "iCloud.com..." identifier for the exports and another with the "TeamIdentifier.com..." identifier for the Ensembles-CoreData syncing. I explicitly use the URLs for the Containers using the method:

[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"iCloud.com..."]

I already tried to only use the TeamIdentifier-Container, but there was no change in the visibility of the AppContainerFolder.

I tried to bump the BundleVersion, I played around with the Info.plist NSUbiquitousContainers settings. I also made Builds available through TestFlight to external testers, to see if it has something to do with development devices.

The only thing, I hadn't done yet, to release a new version to the AppStore with a new BundleVersion, to see if it has something to do with a productive app vs. an app in development.

Any tips and hints welcome.

Neolith answered 14/10, 2015 at 8:34 Comment(9)
Have you set the access to Public in the apps info.plist? (NSUbiquitousContainerIsDocumentScopePublic=YES)Wareroom
<key>NSUbiquitousContainers</key> <dict> <key>iCloud.au.com.ossh.AppName</key> <dict> <key>NSUbiquitousContainerIsDocumentScopePublic</key> <true/> <key>NSUbiquitousContainerSupportedFolderLevels</key> <string>None</string> </dict> </dict>Wareroom
Hello Duncan, thank you for your hint, but yes, i did that: <key>iCloud.com...</key> <dict> <key>NSUbiquitousContainerIsDocumentScopePublic</key> <true/> <key>NSUbiquitousContainerName</key> <string>TaptileApps</string> <key>NSUbiquitousContainerSupportedFolderLevels</key> <string>One</string> </dict>Neolith
So, for you it is working @Duncan? You are saving a file from an iOS app to iCloud Drive and are able to see that file in the iCloud Drive app on the same device short after saving?Neolith
Well the app saves it to the apps ubiquity container and that shows up as a folder on iCloud Drive, from there you can add/delete documents - you can test it yourself by downloading a free version of the app (iProjectFree).Wareroom
@Duncan I believe you, I just had hoped, you would have written something like Michael below regarding App approval and release. Though my app has been released already and it doesn't work as in development.Neolith
Klaus, I am seeing the same problem. Like you the iCloud Drive fielder is visible and can be opened on Mac OS X and via the web. However, the folder is disabled on the iOS iCloud Drive app. My app has not been approved by Apple yet either. Do you now think that is the problem?Francis
Btschumy, it sounds like the same problem, though my app is already approved. Maybe it is something else, we don't see yet.Neolith
@Francis Solution is now posted below, perhaps it's the same for you?!Neolith
N
7

After clarification with the Apple Developer Technical Support, I was now able to solve the issue.

My app declares two exported UTI's (own backup files), so that the iCloud container will default to NOT being enabled (or grayed out), when other files than these UTI's are saved into that folder. Our app is able to create PDF's and CSV's, but these file types were NOT declared as 'Document types' in the info.plist, because our app is not able to display them.

When adding the PDF and CSV document types to the info.plist, the iCloud container gets instantly visible in the iCloud Drive app.

For your reference, here is an extract of the info.plist:

...
<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>Adobe PDF</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Alternative</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.adobe.pdf</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>CSV</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Alternative</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.comma-separated-values-text</string>
        </array>
    </dict>
</array>
...
Neolith answered 6/11, 2015 at 13:26 Comment(5)
That seems annoying. My app does place a couple of .txt files in the cloud container. These are config files that I want to share across devices. It does not mean I want to say my app can in general open .txt files. I guess a possible solution is to invent my own extension for these and add it to my exported UTIs. Anyway, thanks for the information.Francis
@Francis My export files do have their own extension and I added these to the exported UTIs (though I had an error there too), but as I understood, I do have to add the documentTypes also, even if my app can't open the exported PDFs. And YES, it is annoying ... better WRONG, because now our app is displayed in the list of apps being able to open PDFs. I will have to update the Apple Bug, but atm I am too busy for that. Perhaps Apple changes their implementation of that. Anyways .. try it first without the DocumentTypes, but you know now what to try next, if its not working.Neolith
Thanks for the tips here. I followed what you did, but found a slightly different solution. I only have one document type in my ubiquitous container - my own doc type. So I did not add CSV or PDF - since my app doesn't do anything with them. I did find that I needed to have the CFBundleDocumentTypes array (with one entry for my document type), also the NSUbiquitousContainers dict and the UTExportedTypeDeclarations array. After I ran my app on my iPad I noticed my folder was still disabled inside the iCloud Drive app. I restarted the iCloud Drive app and my folder became enabledSimonsen
@derekknight Am in a similar situation, and have done everything you have, but it's still disabled. The app doesn't have to be approved and in the store right?Fichu
Nevermind. i needed to add <string>public.data</string> <string>public.content</string> to UTTypeConformsTo.Fichu
N
1

The post Why my app is not shown in iCloud Drive Folder seems to indicate your app needs to be approved and released before a public iCloud folder works fully.

Nothing answered 15/10, 2015 at 9:53 Comment(3)
Not so, I have apps in beta testing and their containers are visible.Wareroom
Thank you @DuncanGroenewald - you are quite right. I just tried this. Pre-existing old style container id - changed NSUbiquitousContainerIsDocumentScopePublic from false to true, and the container appears in the iCloud Drive app, and the files are accessible. Syncing of NSUbiquitousContainerName and NSUbiquitousContainerIsDocumentScopePublic between iOS and OS X seems quite fast. Bumping CFBundleVersion each time.Nothing
@Michael Thank you for your hint, I had seen this question already and also released the first version with the iCloud Drive Export feature. But it seems, that it hadn't to do anything with this. It seems I will have to open a technical request with Apple to see, if it is some other kind of 'magic' with iCloud on Apple's servers.Neolith

© 2022 - 2024 — McMap. All rights reserved.