ManagedObjectContext deleteObject: corresponds to not deleting data from the Core database?

I am trying to delete a row from a base database in an ios application, but its not working,

if (editingStyle == UITableViewCellEditingStyleDelete) { appDelegate = [[UIApplication sharedApplication] delegate]; NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"PRODUCTTABLE" inManagedObjectContext:appDelegate.managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entityDesc]; NSError *error; NSManagedObject *matches = nil; NSArray *objects = [appDelegate.managedObjectContext executeFetchRequest:request error:&error]; NSLog(@"Array Count....%d",[objects count]); matches=[objects objectAtIndex:([indexPath row])]; NSLog(@"...%@",[matches valueForKey:@"productID"]); NSLog(@"...%@",[matches valueForKey:@"pName"]); NSLog(@"...%@",[matches valueForKey:@"pPrice"]); NSLog(@"...%@",[matches valueForKey:@"pDate"]); [appDelegate.managedObjectContext deleteObject:matches]; } 

o / p for the following code:

 Array Count....12 ...ABC1226 ...ABC-005 ...599.39 ...2012-08-09 05:07:50 +0000 

am retrieving data from master data with the same NSManagedObject. Why is the deletion not updated by master data?

+4
source share
1 answer

Keep the context after the changes.

 NSError * error = nil; [appDelegate.managedObjectContext deleteObject:matches]; [appDelegate.managedObjectContext save:&error]; 
+10
source

All Articles