我需要在删除任务之前更新它。我发现在NSFetchedResultsChangeDelete中执行此行[self.fetchedResultsController objectAtIndexPath:indexPath];
时应用程序崩溃了。
case NSFetchedResultsChangeDelete:{
Task *task = [self.fetchedResultsController objectAtIndexPath:indexPath];
[self deleleReminderForTask:task];
[self checkForUpdateForTaskForDelete:task];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
崩溃日志:
CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. *** -[_PFBatchFaultingArray objectAtIndex:]: index (40324416) beyond bounds (1) with userInfo (null)
任何人都可以帮我解决这个问题。
答案 0 :(得分:1)
已获取的结果控制器已更新,因此您无法尝试从中获取该项目。相反,您应该使用作为参数传递给委托方法的对象。如果您仍然遇到问题,还应检查您对已删除项目的操作。