Referencing NSData's length in a predicate?
Referencing NSData's length in a predicate?
- Subject: Referencing NSData's length in a predicate?
- From: Dave DeLong <email@hidden>
- Date: Fri, 27 Nov 2009 23:03:57 -0700
Hi everyone,
I have a Core Data object called "Item". One of its attributes is a binary attribute called "data". I've constructed a fetch request to retrieve all Items based on the length of the data (ex: "data.length <= 1024"). I *know* that I have Items with data less than 1KB, yet when I execute this predicate, it doesn't seem to be returning anything (nothing shows up in my NSTableView of results, while the results of every other fetch request show up just fine).
My Items' data can potentially be very large (in the megabyte range), so the fetch request is only fetching small properties (title, date, etc). Thinking this might be causing issues, I changed the request to retrieve all Item properties. However, I still didn't get any results. I've tried doing sizes greater than 1024 (like 1048576 [1 MB] or 1073741824 [1 GB]), but those don't return anything either.
What's curious is that I can use data.length in a keypath. I've bound my NSArrayController of Item objects to my UI, and one of the bindings is to show the @sum.data.length of the controller's arrangedObjects, and that's (apparently) working properly. However, when I try to use it in a predicate, I get nothing.
For example, I have at least one Item that has a data of length 414 (as reported by my @sum.data.length binding). Here's how the following predicates work out:
data.length == 414 => returns 0 of 153 items
data.length != 414=> returns 153 of 153 items
data.length < 415 => returns 1 item (size 251B)
data.length <= 414 => returns 1 item (size 251B)
data.length >= 414 => returns 151 of 153 items
data.length > 413 => returns 151 of 153 items
I haven't found anything in the documentation that indicates that this wouldn't work, so can you help me see what I'm missing?
Thanks!
Dave
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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