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: David Reed <email@hidden>
- Date: Wed, 14 Dec 2011 15:43:22 -0500
On Dec 14, 2011, at 2:05 PM, Keary Suska wrote:
> 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"
No, neither of those work either, but thanks for the suggestions. I'll just sort the array afterwards. I'm more worried about the fetch requests not matching the data I want so I'll check closely for that while testing. This is my first attempt at Core Data as my other iOS app was written when iOS 2.0 was out and Core Data didn't exist for iOS then. It certainly removes a lot of code but there is the trade-off of the mystery of what it's doing vs. sqlite which I know what it's doing.
Thanks,
Dave
_______________________________________________
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