I need to quickly check to see if I have some duplicate values in CoreData. I am doing some background syncing and occasionally a dupe makes it into my system.
I have a ManufacturerID and an ItemID and I cannot have a duplicate value for both, example of bad data:
ManufacturerID ItemID
35 IT001
35 IT001
So I would just want to know if that happened and maybe get a list of those ItemID’s, then I need a way to figure out how to get rid of the dupes but this is a good start.
I just need a fast method figure out if they exist or not.
In my app I have a SynchManager that using NSoperations performs synch in background and store new records in the persistent sqlite store only if not alredy stored.
Basically what I do is:
before insert a new object in the store I call a method like “shouldImportObject:“, which basically test that the url is not already stored in the database. This is a simplified implementation sample: