我需要在删除任务之前更新它。我发现当在 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)
任何人都可以帮我解决这个问题吗?
最佳答案
获取结果 Controller 已更新,因此您无法尝试从中获取项目。相反,您应该使用作为参数传递给委托(delegate)方法的对象。您还应该检查您对已删除项目的处理方式是否仍然存在问题。
关于iphone - 核心数据删除崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18541213/