我正在构建一个测试工具来验证CloudKit中的内容,但我希望能够选择容器的环境。
在iOS上,您可以在导出应用程序进行临时测试时选择“开发”或“生产”环境,但在OS X上没有该选项。它始终指向“开发”环境。
任何人都知道,如果在OS X或iOS上有以编程方式设置或选择要使用的容器环境吗?
答案 0 :(得分:5)
答案 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-environment
from 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.