I have a UITabBarController with two tabs. Each tab has a UINavigationController and each nav controller has a table view. The first tab lets you see and edit a list of all employees. The second tab lets you see a subset of the employees. My problem is that in the first tab you can delete an employee from core data. However, when you go back to the second tab it crashes because it still has a pointer to the deleted employee. Is there an easy way to check if an nsmanaged object has been deleted, or is there a way to notify or listen for deletions? Thanks
A:
Register for NSManagedObjectContext NSManagedObjectContextDidSaveNotification
Call NSFetchedResultsController mergeChangesFromContextDidSaveNotification:
Take a look at the Core Data Books sample code.
falconcreek
2010-08-19 14:53:49
A:
If you are using NSFetchedResultsController
instances on each table view then you just need to perform a save in the first tab and respond to the delegate methods on the second.
If you are not using a NSFetchedResultsController
you should be if you are display a table of data.
Marcus S. Zarra
2010-08-19 21:58:15