I'm trying to use an NSPredicate to search for string matches against an array of CoreData objects generated like so:
// Grab an array of all Company projects
NSArray *array = [[company projects] allObjects];
I use the following predicate to match any project names, company names or client names with a case-insensitive string (note: this should allow for partial matches, so that 'App' will match 'Apple Inc.', etc):
(name LIKE[cd] %@) OR (ANY companies.name LIKE[cd] %@) OR (ANY companies.clients.name LIKE[cd] %@)
The CoreData relationships mentioned in the predicate look like so:
SELF -> (NSString *) name
SELF -> (NSSet *) companies -> (NSString *) name
SELF -> (NSSet *) companies -> (NSSet *) -> clients -> (NSString *) name
Whenever I attempt to filter by the above predicate, I find the following in my Console:
HIToolbox: ignoring exception 'Can't do regex matching on object {(
"Apple Inc.",
"Test Co.",
Microsoft
)}.'
If I'm understanding things correctly, it looks as though trying to match against the keypath "companies.clients.name" returns an NSSet (or other object) where an NSString (name) was expected.
What am I doing wrong?