Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 具有UILocalizedIndexedCollation的NSFetchedResultsController_Ios_Objective C - Fatal编程技术网

Ios 具有UILocalizedIndexedCollation的NSFetchedResultsController

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

我正在实现自定义联系人应用程序,它支持多个本地化,现在我被困在汉字排序和索引上,我看到了一些堆栈溢出的博客,人们建议使用UILocalizedIndexedCollation来解决这个问题,但由于FRC未与UILocalizedIndexedCollation很好地连接,因此在设备上从中文模式切换回英文模式时,我看不到任何数据。我使用瞬态属性解决了此问题,它在中文模式下工作,在设备处于英文模式时无法获取数据

-(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;
}