【发布时间】:2017-12-12 15:44:26
【问题描述】:
我只是尝试删除CKRecord。在我将它分配为父级并引用另一个 ckrecord 之前,如下所示:
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)
}
错误如下:
“删除记录时出错:记录删除将违反验证引用 ([C1A31F1D-914F-4007-8C8B-73FC0503C798, ...]),拒绝更新”
这是为了删除记录而不删除其子记录,这就是为什么我在那里设置操作.none 而不是.deleteSelf。
怎么了?
仪表板中的相同:
对应的参考记录有很好的设置:
如您所见,删除 Self 未被选中。我错过了什么吗?对我来说,它应该毫无问题地删除它。
【问题讨论】:
-
在 CKRecord 设置父属性创建记录的层次结构。我想无论您选择 .none 还是 .deleteSelf 作为操作,都已经设置了层次结构。尝试评论该行,因为您自己使用 regionGroup 记录属性完成了层次结构。也许这行得通...