SQL ベースのコア データ マネージド ドキュメントがあり、NSFetchedResultsController に基づくテーブルビューを使用してそのコンテンツを表示します。データは確かに表示されており、すべてそこにありますが、実際に並べ替えようとしても並べ替えられていません。フェッチされた結果コントローラーを設定する方法は次のとおりです。
- (void)setupFetchedResultsController // attaches an NSFetchRequest to this UITableViewController
{
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Notebook"];
NSSortDescriptor *descriptor=[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
request.sortDescriptors = [NSArray arrayWithObject:descriptor];
// no predicate because we want ALL the notebooks
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
managedObjectContext:self.dbContext
sectionNameKeyPath:nil
cacheName:nil];
}
name は文字列型の属性です。タイプ NSDate の別の属性も試しました。それらのどれも機能しません-ドキュメントに変更が適用される前にアプリが起動した直後にテーブルビューが表示されても、データはソートされません。
アイデア?