手動で行わないsynthesize
とNSFetchedResultsController
property
、アプリがクラッシュします。
クラッシュログ:
*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2380.17/UITableView.m:1070
2013-03-06 15:09:15.667 Staff Manager[6673:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 2 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
私がsynthesize
それを次のようにすると、すべてが期待どおりに機能します:
@synthesize fetchedResultsController = _fetchedResultsController;
説明できますか?
私の知識の状態は、Xcodeのコンパイラが私のためにこれを行うということです。
Xcodeバージョン:4.6展開ターゲット:6.1
このメソッドでアプリがクラッシュする(最後の行)
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self.tableView beginUpdates];
Person *personToDelete = [self.fetchedResultsController objectAtIndexPath:indexPath];
[self.managedObjectContext deleteObject:personToDelete];
[self.managedObjectContext save:nil];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[self performFetch];
[self.tableView endUpdates];
}
}