Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.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
Iphone 将NSFetchedResultsController的结果转换为NSArray_Iphone_Objective C_Core Data - Fatal编程技术网

Iphone 将NSFetchedResultsController的结果转换为NSArray

Iphone 将NSFetchedResultsController的结果转换为NSArray,iphone,objective-c,core-data,Iphone,Objective C,Core Data,我使用NSFetchedResultsController在一个表视图中填充一个快速的字母索引。这很好,但我想实现另一个开发人员开发的搜索功能,这个搜索功能需要输入一个基本的NSArray(它通常与一个简单的NSFetchRequest的结果一起工作)。那么,如何进行这种转换呢 以下是请求部分: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity:[NSEntityDescri

我使用NSFetchedResultsController在一个表视图中填充一个快速的字母索引。这很好,但我想实现另一个开发人员开发的搜索功能,这个搜索功能需要输入一个基本的NSArray(它通常与一个简单的NSFetchRequest的结果一起工作)。那么,如何进行这种转换呢

以下是请求部分:

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:
方法后

如果您对答案满意,请将其标记为已接受。对不起,我不打算这样做,但由于时间不够,我无法正确尝试……但我想它会起作用,因此您可以获得我的投票:)