So i have been strugguling wit this for over a week now and i just cant seem to find the answer.
I am working with core data and everything is fine until the point where i have to delete some entries. as soon as i fetch with a predicate and delete the object, it does delete it but the probleme is its deleting EVERYTHING in all other attributes of the same entity. can anyone help me with this ?
AppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext * context = appDelegate.managedObjectContext;
NSError *error = nil;
NSNumber *n = [NSNumber numberWithInt:1];
NSFetchRequest *fetch = [[NSFetchRequest alloc] init];
fetch.entity = [NSEntityDescription entityForName:@"LevelCoreData" inManagedObjectContext:context];
fetch.predicate = [NSPredicate predicateWithFormat:@"firstTime == %@", n];
NSArray *fetchedProducts=[context executeFetchRequest:fetch error:&error];
for (NSManagedObject *product in fetchedProducts) {
[context deleteObject:product];
}
[appDelegate saveContext];