我正在尝试获取所有不同的身份值(联系人有很多身份)。我也试图从联系人模型中获取contact.sectionIndex。我正在尝试下面的代码,并为每条记录获取“部分名称键路径'Contact.sectionIndex'的返回零值”。
NSFetchRequest *req = NSFetchRequestMake(@"Identity", managedObjectContext);
req.fetchBatchSize = 20;
req.sortDescriptors = NSSortDescriptors1(@"sortname", YES);
[req setResultType:NSDictionaryResultType];
[req setReturnsDistinctResults:YES];
[req setPropertiesToFetch:@[@"identityID", @"sortname"]];
// Create & return the fetchedResultsController.
fetchedResultsController = [[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest
managedObjectContext:managedObjectContext
sectionNameKeyPath:@"contact.sectionIndex" cacheName:nil];
[VenmoUtilities performFetch:fetchedResultsController critical:NO];