gpt4 book ai didi

ios - 如何获得核心数据的不同值与关系值?

转载 作者:行者123 更新时间:2023-11-29 03:48:36 25 4
gpt4 key购买 nike

我正在尝试获取所有不同的身份值(联系人有许多身份)。我还尝试从联系人模型中获取 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];

最佳答案

用作 sectionNameKeyPath 的属性必须包含在 propertiesToFetch 中:

[req setPropertiesToFetch:@[@"identityID", @"sortname", @"contact.sectionIndex"]];

关于ios - 如何获得核心数据的不同值与关系值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17370008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com