iphone - Write SortDescriptor for a transforable attribute in core data? -
I have an entity header and it was declared to be changed in a characteristic NSDictionary model. Now I do not want to sort the array of headers in fetchedRequestController. And the zero or null object passes error. Please help with this. Let me reframe the last time: If I have a unit, which has headers with variable attributes, I change the ID type in the generated square to the NSDictionary. Now I need to use the key of the dictionary as entity.attribute name.key ... I do not have any error coding as this class key is not coding compliant for the key: (key) ... this Problem solving is a work done
Create and configure a fetch request with the Book Entity. NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription * entity = [NSEntityDescription entityForName: @ "Header" inManagedObjectContext: self.tableCellGenericMoc]; [FetchRequest Set Entity: Entity]; // Sort descriptor Create array NSSortDescriptor * headersDescriptor = [[NSSortDescriptor alloc] initWithKey: @ "headersDictionary" Ascending: NO]; NSArray * Sort descriptor = [[NSArray alloc] initWithObjects: header descriptor, zero]; [FetchRequest SetSearch synthesizer: Sort descriptor]; // Get started and start the controller start the controller. NSFetchedResultsController * aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest: fetchRequest managedObjectContext: self.tableCellGenericMoc sectionNameKeyPath: @ "headresDictionary" cacheName: @ "root"]; Self.fetchedResultsController = Affected Results Controller; FetchedResultsController.delegate = self;
gives the selectors can not ranked due to an error headersDictionary ...
Why are you archiving an NSDictionary in core data? It's just to do it, it's doing wrong. If you want something like a dictionary, then create a child object on one end of the other, in which many relationships have the name and value.
If you design correctly to your model, so that you do not have to deal with the problem are running now and as you filter your NSFetchRequest and direct a type descriptor Can be used.
Update
Oh thank you ... The problem is that I do not have any definite key structure of the dictionaries available from the web .. so I want to get the dictionary because it as a convertible feature
still makes no sense I've described design is similar to a dictionary within a variable object, except that the core data layer Useful at You do not need a definite key in the design that I told you.
Reconsider your design and this question is irrelevant.
Comments
Post a Comment