核心数据无效规则不起作用? [英] Core Data Nullify rule doesn't work?
本文介绍了核心数据无效规则不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关系 Order&-;> Row
,两个关系删除规则都设置为 Nullify
。但是,当我如下删除行时,不会将其从订单的行列表中删除吗?
I have a relationship Order<-->>Row
with both relationship delete rules set to Nullify
. But when I delete a row as below, it is not removed from the Order's row-list?
// Prints "1" as there is one row in the order
NSLog(@"Number of children before: %d", order.rows.count);
for (Row *row in order.rows)
[moc deleteObject:row];
// Prints "1", should be "0"
NSLog(@"Number of children after: %d", order.rows.count);
这可以强制执行该行为,但这不是必需的。可能是什么问题?
This can force the behavior, but it shouldn't be needed. What might be wrong?
for (Row *row in order.rows)
{
[moc deleteObject:row];
[order removeRowsObject:row];
}
推荐答案
那不是nullify所做的。请改用级联。我在两天前回答了类似的问题,如果需要更多详细信息,请查看它:删除(更新)coreData对象
That's not what nullify does. Use cascade instead. I answered a similar question to this 2 days ago, look at it if you need more detail: Deleting (updating) coreData objects
这篇关于核心数据无效规则不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文