使用https://github.com/magicalpanda/MagicalRecord
的CoreData操作我有2个表,
播放列表和曲目是多对多关系,删除规则是Nullify。
有两种情况:
[self MR_fetchAllSortedBy:@"CreateTime" ascending:NO withPredicate:nil groupBy:nil delegate:self inContext:context];
......
Tracks *obj = [self.fetchedResultsController objectAtIndexPath:indexPath];
[obj MR_deleteEntity];
[[obj managedObjectContext] MR_saveToPersistentStoreAndWait];
快速删除跟踪对象。
[self MR_fetchAllGroupedBy:@"Album" withPredicate:nil sortedBy:nil ascending:NO delegate:self inContext:context];
......
segue push
id<NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:indexPath.row];
AlbumTracksViewController *albumTracksvc = segue.destinationViewController;
albumTracksvc.tracks =[NSMutableArray arrayWithArray:[sectionInfo objects]];
albumTracksvc.title = [sectionInfo name];
In AlbumTracksViewController:
Tracks *obj = [self.tracks objectAtIndexPath:indexPath];
[obj MR_deleteEntity];
[[obj managedObjectContext] MR_saveToPersistentStoreAndWait];
the delete Track Object very slow.
我该怎么做才能解决删除缓慢的问题?