核心数据 – fetchBatchSize被忽略

我正在build立一个NSFetchedResultsController,在请求上设置一个批处理大小,并执行获取。

根据性能,内存使用情况,日志logging(只要访问实体的属性)和SQL日志logging(在SQL查询中没有提及限制),显然fetchBatchSize被忽略,并且所有的对象都被提取。

造成这种情况的原因可能被忽略了?

NSFetchRequest *request = [NSFetchRequest new]; NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:context]; [request setEntity:entity]; [request setSortDescriptors:[[NSSortDescriptor alloc] initWithKey:@"dateCreated" ascending:NO]]; [request setFetchBatchSize:50]; self.fetchController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:context sectionNameKeyPath:nil cacheName:nil]; NSError *error; [self.fetchController performFetch:&error]; 

请注意,如果我在获取之前设置了一个断点,则该请求的确设置为批处理大小限制为50; 但SQL日志logging没有提到它。