iPad:CoreData FetchedRequest 忽略谓词中的更改
在编写 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];
}
}
有人可以帮忙吗?
顺便说一句:请原谅我痛苦的英语;-)
While programming an iPad-app, I'm just running into trouble using a fetchedResultsController with a "dynamic" predicate. it seems the changes to the predicate get ignored. No matter how the predicate changes, I always get the result of the first fetch ...
same code runs without no problems on iphone-env (3.1.x) !!
sample :
- (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];
}
}
can anyone help plz ?
btw.: excuse my painful english ;-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您更改谓词或 fetchRequest 时,必须始终清除缓存
You must clear cache all time when you change predicate or fetchRequest