、などRecordID
の連絡先の特定の詳細を保存するためにコアデータを使用しています。Modificationtimestamp
次のメッセージでアプリがクラッシュします。
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 (68) beyond bounds (57) with userInfo (null)
2012-12-12 13:10:11.585 SalesPro[351:907] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[_PFBatchFaultingArray objectAtIndex:]: index (68) beyond bounds (57)'
これはクラッシュログです:
Last Exception Backtrace:
0 CoreFoundation 0x389c029e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3519797a objc_exception_throw + 26
2 CoreFoundation 0x389c01c0 +[NSException raise:format:] + 100
3 CoreData 0x36f656ce -[_PFBatchFaultingArray objectAtIndex:] + 142
4 CoreData 0x3701e5ec +[NSFetchedResultsController(PrivateMethods) _insertIndexForObject:inArray:lowIdx:highIdx:sortDescriptors:] + 224
5 CoreData 0x3701adf2 -[NSFetchedResultsController(PrivateMethods) _postprocessInsertedObjects:] + 510
6 CoreData 0x3701ca82 -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 2402
7 CoreFoundation 0x38911032 _CFXNotificationPost + 1422
8 Foundation 0x3a073d8c -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
9 CoreData 0x36faa302 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 74
10 CoreData 0x36fa9862 -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 294
11 CoreData 0x36f2bc06 -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 2694
12 CoreData 0x36f2b10a _performRunLoopAction + 266
13 CoreFoundation 0x389956c8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
14 CoreFoundation 0x389939bc __CFRunLoopDoObservers + 272
15 CoreFoundation 0x38993d12 __CFRunLoopRun + 738
16 CoreFoundation 0x38906eb8 CFRunLoopRunSpecific + 352
17 CoreFoundation 0x38906d44 CFRunLoopRunInMode + 100
18 GraphicsServices 0x346df2e6 GSEventRunModal + 70
19 UIKit 0x3910e2f4 UIApplicationMain + 1116
20 SalesPro 0x000a4c0c 0xa3000 + 7180
21 libdyld.dylib 0x39ac7b1c start + 0
方法に矛盾はありませんnumberOfRowsInSection
。
編集
テーブル ビューを更新するためのコード
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath {
UITableView *tableView = self.table;
switch(type) {
case NSFetchedResultsChangeInsert:
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView cellForRowAtIndexPath:indexPath];
break;
case NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeUpdate:
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
break;
case NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation: UITableViewRowAnimationFade];
break;
}
[self.table reloadData];
}
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
// The fetch controller has sent all current change notifications, so tell the table view to process all updates.
[self.table endUpdates];
[table reloadData];
}