I have a ManagedPhoto coredata object that contains a NSSet attribute called tags. Each object in the tags set is a NSString.
I need to fetch all ManagedPhoto objects that have tags with a specific value, say 'party'. This is what I'm doing -
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"ManagedPhoto"];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"SELF.tags == 'party'"];
NSArray *results = [self.managedObjectContext executeFetchRequest:fetchRequest error:nil];
But I always get an empty results array even though I know for sure that there are ManagedPhotos with tags containing 'party'. I've tried this as well -
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"SELF.tags IN %@", @[@"party"]];
I've tried many other things as well but nothing has worked so far! Any thought?
tags
just a set of strings, or is it a relationship to another entity having a string property? – Nickeloustags
is just a set of strings – Boorman