如何重命名 iCloud 容器?

How to rename an iCloud container?

我在 TARGETS 的 Signing & Capabilities 部分为我的 iOS 应用程序创建了一个 iCloud 容器,名为:iCloud.myApp

我在使用 iCloud 时遇到很多问题,我在 this article 中发现:

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.

所以问题是如何以及在何处将其从 iCloud.myApp 更改为 iCloud.com.myDomain.myApp?

签名和功能中的容器不可编辑。我在 CloudKitDashboard 中也找不到它。或者我应该创建一个新容器?

容器的名称一旦创建就无法编辑,也无法删除(不幸的是;我在几年前提交了雷达)。

如果您已经创建了iCloud.myApp,您可以使用它!没有真正需要更改以匹配包标识符。这只是一个命名指南。 Apple 允许您创建和使用任何可用的容器 ID。我正在使用我自己的 iCloud.appName 标识符。

在您的代码中,只需指向您的容器 ID:

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

...然后确保它在 Xcode 中的 Signing & Capabilities 中被选中。

如果您真的想用新名称创建一个新的,那么您可以在此处的 Apple 开发者帐户设置中执行此操作:https://developer.apple.com/account/resources/identifiers/list/cloudContainer