Re: predicates and sort descriptors for NSFetchRequest - documentation is a bit vague
Re: predicates and sort descriptors for NSFetchRequest - documentation is a bit vague
- Subject: Re: predicates and sort descriptors for NSFetchRequest - documentation is a bit vague
- From: Keary Suska <email@hidden>
- Date: Wed, 14 Dec 2011 12:05:46 -0700
On Dec 14, 2011, at 11:07 AM, Dave Reed wrote:
> Here's my sorting scenario with a few more details.
>
> Entity A (the one I'm fetching) has a to-one relation to Entity B with attribute b. Let's call the relation "tob" so my sort descriptor said withKey:@"tob.b" and it results of the fetch request did not come back in that order, but if I then sort the resulting array using the sort descriptor, it does sort it.
>
> The way I read the documentation, that should work during the fetch, but it doesn't.
Unfortunately, Core Data-Specific sort descriptor docs are fairly lacking. As I mentioned it may be that NSSortDescriptor doesn't translate key paths like NSPredicate might. It may expect them to be appropriate to a SQL query. Considering that the attribute b or entity B is unambiguous (i.e. entity A does not have an attribute with the same name), have you tried passing just "b" as the key? Another option is passing "B.b" as the key.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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