问题
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