开发者

How to remove deletedObjects from ManagedObjectContext?

开发者 https://www.devze.com 2022-12-18 18:52 出处:网络
I have two enities: path <-->>> node. (one to many) In nodes ArrayController I override -DeleteObjects: to remove path if the last node is removed.

I have two enities: path <-->>> node. (one to many) In nodes ArrayController I override -DeleteObjects: to remove path if the last node is removed.

Everything works perfect, but it's impossible to save edited document, because nodes are left in [ManagedObjectContext deletedObjcets].开发者_运维问答 It gives error on save. How to clean them up?

Babut


My understanding is that, during the save:, the objects in deletedObjects will be deleted. Their presence should not prevent a save.

Are you getting an error? Have you reviewed it detail? Perhaps use the method of error display from this answer to iphone Core Data Unresolved error while saving.


As you said, you have two entities with one to many relationship. If the delete rule is "Deny", deleting the entity will give an error until all of the related records in other entities are not deleted already.

How to remove deletedObjects from ManagedObjectContext?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号