2
votes

I am having my core data model like this:

EntityA <---->> EntityB <<----> EntityC

Now, I want to get objects of EntityB where EntityC == nil.

I have thought about a lot of options:

The one I tried is:

ANY EntityB.EntityC == nil

Though this does not give an error, it does not work how I expect, because this searches all objects of EntityA, and even if one is not nil, it takes that object of EntityA.

So what I tried is:

ALL Participant.ParticipantCategory == nil

but this gives an error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)

I also tried using SubQueries, but did not work out. I have spent hours trying to solve it but no luck.

Any ideas?

1
Could you post the subquery you have tried?Lorenzo B
This is the subquery: SUBQUERY(Participant, $part, part.ParticipantCategory == nil).@count > 0. For this, I get this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath part.ParticipantCategory not found in entity <NSSQLEntity XYZEntity id=2>Bani Uppal
Here, entityB would be Participant and EntityC would be ParticipantCategory.Bani Uppal

1 Answers

1
votes

I think your predicate should be just: Participant.ParticipantCategory == nil

ANY keyword is described here. I think it is behaving as it should. And I'm not aware of an ALL keyword.