Ios 具有UILocalizedIndexedCollation的NSFetchedResultsController
我正在实现自定义联系人应用程序,它支持多个本地化,现在我被困在汉字排序和索引上,我看到了一些堆栈溢出的博客,人们建议使用UILocalizedIndexedCollation来解决这个问题,但由于FRC未与UILocalizedIndexedCollation很好地连接,因此在设备上从中文模式切换回英文模式时,我看不到任何数据。我使用瞬态属性解决了此问题,它在中文模式下工作,在设备处于英文模式时无法获取数据Ios 具有UILocalizedIndexedCollation的NSFetchedResultsController,ios,objective-c,Ios,Objective C,我正在实现自定义联系人应用程序,它支持多个本地化,现在我被困在汉字排序和索引上,我看到了一些堆栈溢出的博客,人们建议使用UILocalizedIndexedCollation来解决这个问题,但由于FRC未与UILocalizedIndexedCollation很好地连接,因此在设备上从中文模式切换回英文模式时,我看不到任何数据。我使用瞬态属性解决了此问题,它在中文模式下工作,在设备处于英文模式时无法获取数据 -(NSString *)sectionIdentifier { [self
-(NSString *)sectionIdentifier {
[self willAccessValueForKey:@"sectionIdentifier"];
NSUInteger index = [[UILocalizedIndexedCollation currentCollation] sectionForObject:self
collationStringSelector:@selector(name)];
NSString *sectionId = [[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:index];
NSLog(@"secKey = %@, value = %@", sectionId, self.name);
[self didAccessValueForKey:@"sectionIdentifier"];
return sectionId;
}