0

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.

Paras Joshi
  • 20,427
  • 11
  • 57
  • 70
Tefa
  • 15
  • 5

2 Answers2

3

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.

Christian Kienle
  • 733
  • 1
  • 14
  • 26
0

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.

Mundi
  • 79,884
  • 17
  • 117
  • 140