I have a data model with a many-to-many relationship like EntityA <-->> EntityB <<--> EntityC
. I used to query EntityA
with different search criteria and I use NSCompoundPredicate
with an array of NSPredicate
s. On one of the predicate I wanted to query EntityA
using EntityC
. I tried to use the following SUBQUERY
but it did not work.
searchPredicate=[NSPredicate predicateWithFormat:@"(0 != SUBQUERY(EntityB, $B, (0 != SUBQUERY($B.EntityC, $EntityC, $EntityC.name like %@).@count)).@count)", name]
And I got the following exception,
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:
'Can't perform collection evaluate with non-collection object.'
Is there anything I'm missing. I would appreciate any help.
Sarah
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…