2013-08-30 173 views
0

我需要在任務被刪除之前更新它。我發現當這行[self.fetchedResultsController objectAtIndexPath:indexPath];在NSFetchedResultsChangeDelete執行應用程序崩潰。核心數據刪除崩潰

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) 

任何人可以幫助我解決這個問題。

回答

1

獲取的結果控制器已更新,因此您無法嘗試從中獲取項目。相反,您應該使用作爲參數傳遞給委託方法的對象。你還應該檢查你正在做什麼與刪除的項目,你仍然有問題。

+0

感謝您的快速回復Wain – karthik