开发者

How to detect object is cascade deleted by coredata

开发者 https://www.devze.com 2023-01-12 09:25 出处:网络
I have two entities: Folder <-->> Document, a开发者_运维问答nd Folder defines a To-Many relationship to Document with a cascade delete rule. My question is: is there some way for document object it

I have two entities: Folder <-->> Document, a开发者_运维问答nd Folder defines a To-Many relationship to Document with a cascade delete rule. My question is: is there some way for document object itself to detect when it is cascade deleted ?


Your Document should receive a -[NSManagedObject validateForDelete:] message. You can also check whether an NSManagedObject is deleted (or scheduled for deletion) with -[NSManagedObject isDeleted]. So your Document's methods can perform the check on [self isDeleted].

0

精彩评论

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