Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Default zone is not accessible in shared DB - cloudKit

I am trying to save to cloud kit shared database. The shared database does not allow zones to be set up.

How do I save to sharedCloudDatabase without a zone?

private func addItem(recordType: String, name: String) {
    let record = CKRecord(recordType: recordType)
    record[Constances.field.name] = name as CKRecordValue
    record[Constances.field.done] = false as CKRecordValue
    record[Constances.field.priority] = 0 as CKRecordValue
    CKContainer.default().sharedCloudDatabase.save(record) { [weak self] returnRecord, error in
        if let error = error {
            print("Error saving record: \(record[Constances.field.name] as? String ?? "No Name"): \n \(error)")
            return
        }   
   }     
}

The following error message prints out:

Error saving record: Milk: <CKError 0x15af87900: "Server Rejected Request" (15/2027); server message = "Default zone is not accessible in shared DB"; op = B085F7BA703D4A08; uuid = 87AEFB09-4386-4E43-81D7-971AAE8BA9E0; container ID = "iCloud.com.sfw-consulting.Family-List">

If you're trying to save it into the sharedDB, that's another user's privateDB. Is that what you intend to do here?

As far as I know, you can't do that outside of a zone on the other user's account.

Default zone is not accessible in shared DB - cloudKit
 
 
Q