I have a UITableViewController backed by a NSFetchedResultsController.
I’m currently experiencing a SIGABRT when deleting a row, after I save the managedObjectContext in commitEditingStyle.
The crash then happens in drawRect: in my UITableViewCell where it tries to access the core-data object for this row:
[self.document.name drawAtPoint:...]
The SIGABRT exception is:
<0x7f883f0 DocumentListControllerCell.m:(108)> CoreData could not fulfill a fault
for '0x7f2a600 <x-coredata://A71C21B4-FE2A-4D1B-A76F-A2AB80E4814C/Document/p16>'
Of course the issue is that the CoreData object has been deleted and cannot be accessed anymore. I wonder why drawRect is still called for this cell.
Any help would be appreciated!
I see one solution but I would like to know if it’s the correct way to solve this problem.
The issue currently is that
drawRectin the cell access the CoreData “document” which was deleted, to get the document name and draw it. Instead of doing that, I could cache the document name in a string insetDocumentand directly access this string.It seems like it would be the right way to do that. Could someone confirm that I should not access the Core Data object in
drawRect?