I have been reading through the core data documentation and feel I am still missing something.
I do not quite understand how you insert objects into a relationship of another object.
For example the following two Entities are in my model
flightDepartureBoard
name:
from_airport:
to_airport:
current_flights: (this is a one to many relationship of flight detail entities)
flight_details
arrive
depart
name
So my data contains a list of different departure boards for a few airports. Each departure board then contains a number of flight_details containing info on the current arrivals and departures for that airport.
My current understanding is to insert the flight details for a specific departure board, I must get the managedObject for the board, then create a new managed object for each flight and set its values as appropriate then create an NSSet conatining the flight managed objects and set the depatureboards managedObject current_flights (the relationship) to the just created NSSet. Is this correct?
What if I want to add new entries? I assume I do not need to fetch the entire set first?
Thanks for any help..
Although I just realised I could set the relationship to the current object on the flightDetails object instead..
[flights addObject:details]
do you get a compiler warning? I'm seeing that the relationship is a NSSet, not an NSMutableSet. - user798719