Re: Localized sorting of a Core Data entity
Re: Localized sorting of a Core Data entity
- Subject: Re: Localized sorting of a Core Data entity
- From: Ray <email@hidden>
- Date: Fri, 08 Apr 2011 10:27:23 +0200
First: Quincey, Dado, Chase, WT, thanks for your comments, much appreciated!
On Apr 7, 2011, at 6:53 PM, Quincey Morris wrote:
> On Apr 7, 2011, at 03:06, Ray wrote:
>
>> Right, I tried something like this earlier, but when I use
>>
>> - (NSString*) localizedName {
>> return NSLocalizedString (self.name, nil);
>> }
>>
>> I get an exception:
>>
>> Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath localizedName not found in entity <NSSQLEntity TestEntity id=1>'...
>
> I don't see anything in the documentation for the fetch sort descriptors that says they have to specify a Core Data property, rather than a custom or derived property, although perhaps that is the problem. You didn't use this key somewhere else, like in the fetch predicate, by any chance?
Dado wrote:
> "The SQL store, on the other hand, compiles the predicate and sort
> descriptors to SQL and evaluates the result in the database itself. This is
> done primarily for performance, but it means that evaluation happens in a
> non-Cocoa environment, and so sort descriptors (or predicates) that rely on
> Cocoa cannot work." [1]
>
> [1]
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdPersistentStores.html
I think this nails down the problem. I will have to rethink my approach. I was hoping to be able to resort to other solutions than what one would do with "databases" normally, examples here:
<http://stackoverflow.com/questions/5534681/how-to-represent-a-localized-string-type-in-core-data>
<http://stackoverflow.com/questions/2689570/good-practices-for-multiple-language-data-in-core-data>
(I just glanced through them briefly, btw.)
Anyway, I will post my solution, if any ;)
Thanks again,
- Ray.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden