Core Data predicate : unimplemented SQL generation for predicate

前端 未结 5 1444
旧巷少年郎
旧巷少年郎 2020-12-09 10:50

Basically I got 3 entities in my data model : Brand, Model and Trim.

  • A brand has a one-to-many relationship with Model called \"models\". (one brand have multi
5条回答
  •  囚心锁ツ
    2020-12-09 11:05

    "ANY" in a Core Data predicate works only for a single to-many relationship. Since your query involves two to-many relationships, you have to use a SUBQUERY:

    [NSPredicate predicateWithFormat:@"SUBQUERY(models, $m, ANY $m.trims IN %@).@count > 0",
        arrayOfTrims];
    

提交回复
热议问题