NSFetchedResultsController didChangeObject indexPath为null

Ben*_*ler 3 core-data objective-c nsfetchedresultscontroller ios

我使用NSFetchedResultsController来管理带有CoreData的PSTCollectionView的实现.当我实现以下方法时,indexPath和newIndexPath参数都是null

- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath
{
    switch (type) {
        case NSFetchedResultsChangeInsert:
            NSLog(@"%@", indexPath);
            NSLog(@"%@", indexPath);
            NSLog(@"______");
            break;

        default:
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

我一直在用砖墙砸我的头几个小时,所以会很感激任何指针.它可能与多线程有关吗?我正在一个单独的NSManagedObjectContext实例上的后台线程中处理一个大型JSON文件.

谢谢

Jas*_*wig 11

因为插入没有[old] indexPath?检查newIndexPath参数