これでうまくいくと思いましたが、なぜ間違っているのかわかりません。以下のコードの述語を使用して、フェッチされた結果コントローラーがあります。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription * entity = [NSEntityDescription entityForName:@"SearchResult" inManagedObjectContext:[[DataInterfaceObject sharedAlloc] managedObjectContext]];
[fetchRequest setEntity:entity];
[fetchRequest setFetchBatchSize:10];
// Results Table predicate
NSPredicate *predicate_Results = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects: [ResultsTableVC resultsPredicate], [NSPredicate predicateWithFormat:@"searchUsed.isCollapsedView == NO"], nil]];
// Favorites Table predicate
NSPredicate *predicate_Favorites = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects: [FavoritesTableVC favoritesPredicate], [NSPredicate predicateWithFormat:@"favoritesInfoLink.isCollapsedView == NO"], nil]];
// Full predicate
NSPredicate *predicate =
[NSCompoundPredicate orPredicateWithSubpredicates: [NSArray arrayWithObjects:
predicate_Results, predicate_Favorites, nil]];
[NSFetchedResultsController deleteCacheWithName:@"resultsCache"];
[fetchRequest setPredicate:predicate];
目的はSearchResult
、述語に一致するすべてのエンティティをフェッチすることです。SearchResultエンティティには、searchUsed
SearchResult<<->SearchTermsのような関係があります。SearchTermsにはプロパティがありますisCollapsedView
。
ユーザーはビューをタップして、対応するオブジェクトビューを折りたたむことができます。その時点で、searchUsed.isCollapsedViewの値が更新され、mocに保存されます。私はこれが起こっていることを確認しました。
この変更がフェッチされた結果コントローラーによって認識され、デリゲートメソッドが起動することを期待していましたが、起動しません。
デリゲートメソッドは、検索エンティティが挿入、削除、または更新されたときに起動します。
これは間違って設定されていますか、それとも私の期待は間違っていますか?私はそれについて何ができますか?