Iphone 将NSFetchedResultsController的结果转换为NSArray
我使用NSFetchedResultsController在一个表视图中填充一个快速的字母索引。这很好,但我想实现另一个开发人员开发的搜索功能,这个搜索功能需要输入一个基本的NSArray(它通常与一个简单的NSFetchRequest的结果一起工作)。那么,如何进行这种转换呢 以下是请求部分:Iphone 将NSFetchedResultsController的结果转换为NSArray,iphone,objective-c,core-data,Iphone,Objective C,Core Data,我使用NSFetchedResultsController在一个表视图中填充一个快速的字母索引。这很好,但我想实现另一个开发人员开发的搜索功能,这个搜索功能需要输入一个基本的NSArray(它通常与一个简单的NSFetchRequest的结果一起工作)。那么,如何进行这种转换呢 以下是请求部分: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity:[NSEntityDescri
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"domaine" inManagedObjectContext:managedObjectContext]];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"nom_court" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
[sortDescriptors release];
[sortDescriptor release];
fetchedResultsController = [[NSFetchedResultsController alloc]initWithFetchRequest:fetchRequest
managedObjectContext:managedObjectContext sectionNameKeyPath:@"nom_court" cacheName:@"root"];
[fetchRequest release];
NSError *error;
//BOOL success = [controller performFetch:&error];
[fetchedResultsController performFetch:&error];
谢谢调用
NSArray*fetchedObjects=[fetchedResultsController fetchedObjects]代码>在调用您的performFetch:
方法后如果您对答案满意,请将其标记为已接受。对不起,我不打算这样做,但由于时间不够,我无法正确尝试……但我想它会起作用,因此您可以获得我的投票:)