CKReference .DeleteSelf属性无效 [英] CKReference .DeleteSelf attribute has no effect

查看:138
本文介绍了CKReference .DeleteSelf属性无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.DeleteSelf如何真正起作用?文档说:

How does .DeleteSelf really work? Docs says:


当引用对象的动作设置为
CKReferenceActionDeleteSelf时,引用的目标 - 即$存储在引用的recordID属性中的b $ b记录成为源记录的所有者
。删除目标(所有者)记录将删除其源记录的所有

When the reference object’s action is set to CKReferenceActionDeleteSelf, the target of the reference—that is, the record stored in the reference’s recordID property—becomes the owner of the source record. Deleting the target (owner) record deletes all its source records.

但我的印象是删除目标不会总是删除来源。它仍然在容器中,客户端下载它,并期望参考点到某处,但在客户端上构建服务器数据存储片时不存在目标,这是非常烦人的?

but my impression is that deleting a target will not always delete source. And it is quite annoying when it remains in the container, client downloads it, and expect that the reference point to somewhere, but target does not exist when building up slice of the server data store on client?

你如何对待这个案子?你忽略那种记录?或者定期查找CloudKit存储,搜索损坏的记录以删除它们?

How do you treat this case? You ignore that sort of records? Or periodically you look up the CloudKit storage, searching for corrupt records to delete them?

或者不是删除记录,最好设置它在删除状态,但保留在数据库中?

Or instead of deleting a record is it better to set an attribute that it is in a deleted state, but keep it in the database?

推荐答案

我只是挣扎了一段时间,我想我会分享我的发现......

I just struggled with this one for a while and I thought I would share my findings...

这基本上是一个许可问题。只有当删除记录的用户对所有需要删除的记录具有写入权限时,才能执行级联删除。
因此,在CloudKit仪表板中,级联删除仅适用于使用开发人员的iCloud帐户创建的记录。

It is fundamentally a permission issue. The cascading delete will only work if the user deleting the records has 'write' permissions to all the records needing to be deleted. So in the CloudKit Dashboard, the cascading delete will only work for the records created with the developer's iCloud account.

如果您需要删除不记录的记录属于删除它们的用户,您可以在安全性下为记录类型添加写入权限。

If you need to delete records that don't belong to the user deleting them, you can add 'write' permissions for a Record Type under Security.

这篇关于CKReference .DeleteSelf属性无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆