I have an entity, let’s call it Parent, Parent has up to 5 Child entities as a to-many relationship.
I am displaying these “Parent” relationships in a UITableView; when a user selects the row for a Parent entity I want to display another view that shows some detailed information for this Parent, including all of the Child entities (if any).
What I don’t understand is how I get these Child entities out of Core Data!!! I’ve tried everything, I’ve tried to refresh the Parent from the managed context, I’ve tried to grab it again from the managed context using:
[managedObjectContext existingObjectWithID:[swingSession objectID] error:&error];
I am literally at my wits end, I have no idea what to do!!!
Please help, what am I missing????
You can access the child by the NSSet property in the parent object like so:
This is assuming the relationships are set correctly. A to-Many relationship is an NSSet type.
Your entity should be set up like this:
make sure you set up an inverse To-One relationship on the child to the parent.