エンティティヘッダーがあり、モデルで変換可能と宣言された属性 NSDictionary があります。今、fetchedRequestController でヘッダーの配列をソートしたくありません。nil または null オブジェクトを渡すとエラーが発生します。その緊急を助けてください。
前回から再構成してみましょう: 変換可能な属性ヘッダーを持つエンティティがある場合。生成されたクラスで id タイプを NSDictionary に変更します。entity.attribute name.keyとして辞書のキーにアクセスする必要があります...このクラスはキーのキー値コーディングの苦情ではないため、エラーが発生します:(key)...この問題の回避策は何ですか。
// Create and configure a fetch request with the Book entity.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"headers" inManagedObjectContext:self.tableCellGenericMoc];
[fetchRequest setEntity:entity];
// Create the sort descriptors array.
NSSortDescriptor *headersDescriptor = [[NSSortDescriptor alloc] initWithKey:@"headersDictionary" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:headersDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
// Create and initialize the fetch results controller.
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.tableCellGenericMoc sectionNameKeyPath:@"headresDictionary" cacheName:@"Root"];
self.fetchedResultsController = aFetchedResultsController;
fetchedResultsController.delegate = self;
上記のセレクターは、headersDictionary をソートできないため、エラーが発生します...