I\'m getting a crash when trying to access an object in NSFetchedResultsController
.
2013-11-10 15:15:06.568 Social[11503:70b] CoreData: error: Serio
In one of my NSManagedObject subclasses I had the follwiing code which was causing the issue. NSSets are automatically initialized on NSManagedObejcts and there is no need to initialize them.
- (void)awakeFromFetch
{
if (!self.comments)
self.comments = [NSMutableSet set];
if (!self.medias)
self.medias = [NSMutableSet set];
}
Another problem was that during insert indexPath is null, I had to use newIndexPath instead
case NSFetchedResultsChangeInsert:
[self.tableView insertRowsAtIndexPaths:@[newIndexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
break;