I simply try to delete CKRecord. Before I assigned it as a parent and reference to another ckrecord like this:
let rID = CKRecordID(recordName: territory.identifier, zoneID: territory.recordZoneID)
let record = CKRecord(recordType: "Territory", recordID: rID)
if let territoryGroup = territoryGroup {
let recordID = CKRecordID(recordName: territoryGroup.identifier, zoneID: CloudAssistant.shared.zone.zoneID)
record.parent = CKReference(recordID: recordID, action: .none)
record["territoryGroup"] = CKReference(recordID: recordID, action: .none)
}
and the error is following:
"Error deleting record : Record delete would violate validating reference ([C1A31F1D-914F-4007-8C8B-73FC0503C798, ...]), rejecting update"
This was intended to delete record without deleting its child records, and this is why I set there action .none instead of .deleteSelf.
What is wrong?
The same in dashboard:

For corresponding reference record there is a good setup:

As you can see delete Self is not selected. Am I missing something? For me, it should delete it without problem.
I ran into this same error when I set the parent of the record with setParent(parentRecordID) and also created a CKReference with .none. It looks like if you set the parent, you have to use .deleteSelf on the standard reference. However, from what I can tell, setting the parent is only necessary if you want to use CKShare. I wrote more about it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With