I have a one-to-many relationship and I am just trying to get a few things straight. When I set the relationship from A <-->> B everything is great and works out just the way I like. But when I want to change the relationship, clear everything out and add a couple different B's (than I did before), would I delete the relationship using nullify or cascade if I wanted it to be removed on both ends?
Also could any one give me a quick example of how I might go about this?
I was thinking something like [b setValue:nil forKey:myRelationship]
Is that anywhere close? Or do I need something else?
Thanks.
Cascade Delete RuleIf a note should always have a category, the deletion of a category should automatically delete the notes associated with that category.
Inverse relationships enable Core Data to propagate change in both directions when an instance of either the source or destination type changes. Every relationship must have an inverse. When creating relationships in the Graph editor, you add inverse relationships between entities in a single step.
Overview. After you create a data model file as described in Creating a Core Data Model, set up the classes that collaboratively support your app's model layer. These classes are referred to collectively as the Core Data stack.
These relationship types apply when deleting managed objects themselves, not clearing out the relationships. So, if you have object 'a' linked to 'b', 'c', and 'd', then when you delete 'a':
In all cases, you can use [b setValue: nil for Key: myRelationship] to clear out the relationship on both sides.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With