NSPredicate for searching within relationship entities

前端 未结 1 1113
别那么骄傲
别那么骄傲 2020-12-29 05:16

I have an entity called Band which has a to-many relationship to a Category entity. The Category entity just contains a categoryName string attribute.

An example rec

相关标签:
1条回答
  • 2020-12-29 05:43

    According to the NSPredicate Programming Guide you will need to specify the key path to categoryName with the ANY or ALL specifier.

    NSString *category = @"Rock";
    [NSPredicate predicateWithFormat:@"ANY bandCategories.categoryName == %@", category];
    
    0 讨论(0)
提交回复
热议问题