How to rename an iCloud container?

Viewed 545

I have created an iCloud container for my iOS app in Signing & Capabilities section of TARGETS named: iCloud.myApp

I have many problems with iCloud and I found in this article that:

The app’s bundle ID and iCloud containers must match and they must exist in the developer account. For example, if the bundle identifier is com.myDomain.myApp, then the iCloud container name should be iCloud. plus the bundle bundle id: iCloud.com.myDomain.myApp.

So the question is how and where to change it from iCloud.myApp to iCloud.com.myDomain.myApp?

Containers in Signing & Capabilities are not editable. I cannot find it in CloudKitDashboard as well. Or should I create a new container?

1 Answers

You cannot edit the name of a container once it is created, and you cannot delete it either (which is unfortunate; I filed a radar about that years ago).

If you already have iCloud.myApp created, you can use it! There's no real need to change to match the bundle identifier. It's merely a naming guideline. Apple lets you create and use any container ID as long as it's available. I'm using my own iCloud.appName identifier as we speak.

In your code, just point to your container id:

let container = CKContainer(identifier: "iCloud.myApp")

...and then make sure it's selected in Signing & Capabilities in Xcode.

If you really want to create a new one with a new name, then you can do so in your Apple Developer account settings here: https://developer.apple.com/account/resources/identifiers/list/cloudContainer

Related