Is it possible to get Core Data cascade delete to delete objects more than one level deep?
ObjectA has an NSSet of ObjectB, ObjectB has an NSSet of ObjectC
When I delete ObjectA, I want ObjectB and ObjectC to be deleted.
I set the relationship of ObjectA<->>ObjectB to cascade, and the relationship of ObjhectB<->>ObjectC to cascade but no dice. Any ideas?
The way you described it, these are one-way relationships. So this answer reflects that case. I think that if you set the relationships like this
(I use <–>> to illustrate one-to-many and many-to-one, since you describe the
relationship of a to b where b is a set.)
you will have object b depending on the existence of object a and object c depending on the existence of object b.
Then if object a disappears, then object b sees that the relationship is not fulfilled and will delete itself. Then object c will see that the relationship is not fulfilled and delete itself.
As it is written in your question, object b does not have a relationship to object a, so it is not expecting anything with respect to object a.