I am trying to import data from a database that uses primary key / foreign key relations to a core data database in Xcode.
I have code that creates hundreds of child entities in a managed object context:
Each child has an ID that corresponds to a parent.
child1 parentID = 3
child2 parentID = 17
child3 parentID = 17
...
childn parentID = 5
I now need to relate each child to its parent. The parents are all stored in persistent memory.
My first thought was to preform a fetch for each child to get its parent. However, I think this would be slow.
Am I correct? How should I do this instead?