Reputation: 1381
I have been using an iCloud container without a problem during my developing phase. The container app had until now a default NSUbiquitousContainerName, using the bundle if of the application.
Now I would like to have a friendlier name for the folder appearing in iCloud Drive, so I have changed the NSUbiquitousContainerName value to my app's name.
<key>NSUbiquitousContainers</key>
<dict>
<key>container-id</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>AppName</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
I have then bumped the build number, and run the app. I used the following folder to export documents:
FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents")
And still the documents are exported to the old folder, instead of the new one. What should I do to rename the container's folder?
Upvotes: 1
Views: 1358
Reputation: 39
I had the same problem on Xcode 14 and I confirm that I had to change container name and to increase build number to solve the issue
Upvotes: 0
Reputation: 11
I had the same problem using iOS 13. It appears the old folder name is cached (as is the app icon image used as an overlay on the iCloud folder icon).
Changing NSUbiquitousContainerName in the plist didn't have an impact when using an iCloud account that I'd already used with the old container name, but I got the new folder name (and new app icon) when using with an iCloud account that had never before been connected to the app.
This caching persisted even when running the app on a new device and deleting the old folder from iCloud.
Upvotes: 1
Reputation: 1381
I managed to fix the issue creating a new container and using that one instead of the default.
Upvotes: 0