I have an attribute of type NSData
and I want to search a string in this attribute how can I perform this search using NSPredicate
?
I try to use NSPredicate
with block but predicate with block not supported for Core Data SQlite based store.
I have an attribute of type NSData
and I want to search a string in this attribute how can I perform this search using NSPredicate
?
I try to use NSPredicate
with block but predicate with block not supported for Core Data SQlite based store.
You can't do that easily. The reason for predicates with blocks do not work is that it is not implemented in the SQLite store because it would not be trivial to do so in an efficient manner.
You could have a second attribute which contains a string representation of that data or a condensed version of the string representation and use this attribute instead.
You have to make sure to keep those attributes in sync and make sure both attributes are not transient.
Why do you have an NSData
attribute? Transform it to NSString
when you store it and change your data model accordingly.
It is senseless to store a string in a data object.