CloudKit:将容器环境从开发切换到生产

时间:2014-12-08 18:01:29

标签: ios objective-c xcode cloudkit

我正在构建一个测试工具来验证CloudKit中的内容,但我希望能够选择容器的环境。

在iOS上,您可以在导出应用程序进行临时测试时选择“开发”或“生产”环境,但在OS X上没有该选项。它始终指向“开发”环境。

任何人都知道,如果在OS X或iOS上有以编程方式设置或选择要使用的容器环境吗?

3 个答案:

答案 0 :(得分:5)

在权利文件中,添加com.apple.developer.icloud-container-environment行,您可以在DevelopmentProduction之间来回切换值。

enter image description here

答案 1 :(得分:0)

更新:在更高版本的CloudKit中进行了更改,请忽略此项并查看已接受的答案。

不,没有办法做到这一点。

虽然您可以访问与iOS应用相同的容器,但您只能访问"开发"环境直到您将应用程序作为Mac App导出到App Store(这可能不是您测试工具的目标)。

App Store应用程序再次只能访问"生产"环境。

在特定环境中没有其他API可以访问CloudKit容器。

答案 2 :(得分:0)

I know this might be a bit late for those who posted but for others with the same problem, in the entitlement file change the com.apple.developer.icloud-container-environmentfrom Development to Production Then delete your app from your device so you get a clean build. When you run it, it should work. The key is to have a clean build.

相关问题