How do you delete a core data entry from the detail view?

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-05-05T17:21:47Z Indexed on 2010/05/05 17:28 UTC
Read the original article Hit count: 315

I am working with an app similar to apple's core data recipes sample code. I want to be able to delete the entry from the detail view, much like apple's contacts app.

The code below is deleting the 1st entry and not the selected entry. Not sure what I am doing wrong.

NSIndexPath *indexPath = [myTableView indexPathForSelectedRow];
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
[context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];
[myTableView reloadData];

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data