I am importing a large plist / XML into Core Data. The structure is simple: let's say there is a Man and a Company, and a Company can have many people. Import is successful, but plist does not have an established relationship, therefore, duplicate companies are inserted every time when several people have the same company.
A potential solution is the Apple Core Data Docs in the Effective Build or Build section:
Or, if you import βflatβ data without any relationships, you can create managed objects for the entire set and filter out (delete) any duplicates before saving using one large IN predicate.
I looked at this sentence for a long time and I can not make it out. Didn't I use managed objects to import the whole set? What query query do they refer to?
An algorithm or explanation will be appreciated.
source
share