Question

I want to insert only those records in core data in iPhone which are not already present in the sqllite table. In other words, I want to insert distinct records in my core data table. My code of insertion is

for(NSInteger j=0;j<[items count];j++){
            Story *story=(Story *)[NSEntityDescription insertNewObjectForEntityForName:@"Story" inManagedObjectContext:managedObjectContext];

            [story setTitle:[[items objectAtIndex:j] objectForKey:@"title"]];
            [story setDate:[[items objectAtIndex:j] objectForKey:@"date"]];
     }

Tell me the way to insert only distinct records in this.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top