在编写 iPad 应用程序时,我只是在使用带有“动态”谓词的 fetchedResultsController 时遇到了麻烦。似乎谓词的更改被忽略了。无论谓词如何变化,我总是得到第一次获取的结果......
相同的代码在 iphone-env (3.1.x) 上运行没有问题!
样本 :
- (void)performSearch:(NSString *)searchText {
self.displaySearchResults = TRUE;
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"searchWords contains[cd] %@", searchText];
[self.fetchedSearchResultsController.fetchRequest setPredicate:predicate];
NSError *error = nil;
if (![self.fetchedSearchResultsController performFetch:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
if(deviceIsIPad) {
[self showSearchResults];
}
else {
[cookBookOverview reloadData];
}
}
有人可以帮忙吗?
顺便说一句:原谅我痛苦的英语;-)