Possible to set default CloudKit container not based on application name?

蓝咒 提交于 2019-12-08 05:20:52

问题


When I turn on CloudKit in Xcode, it set and create a default container based on the name of the app. Is it possible to set a different default name? I do not want to see a new container name on the list in CloudKit dashboard, but use an existing one.


回答1:


Janos answer is correct, although I think you even after selecting a different iCloud container, you also have to say so in your code?

let container = CKContainer(identifier: "iCloud.com.kukodajanos.Dating")
let publicDB = container.publicCloudDatabase
let privateDB = container.privateCloudDatabase

I may be wrong of course, that's just the way I found it to work.




回答2:


you can override in Info.plist the Bundle Identifier field. That will have change the default container ID. I changed it com.kukodajanos.$(PRODUCT_NAME:rfc1034identifier) to com.kukodajanos.Dating



来源:https://stackoverflow.com/questions/29053439/possible-to-set-default-cloudkit-container-not-based-on-application-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!