Learn Courses My Dashboard

NSPredicate to filter certain value of properties property

Hi
I have an entity which has a member props
it has one to one relation
then has a member partOfSpeech to which I assign as

Now I want to get all words that has partOfSpeech value of 0

I tried the following predicate but I am running at a runtime error

the predicate I used goes a this:

gPredicate = NSPredicate(format: "any hasPropertyOf.partOfSpeech == 0") 

previously I used

dB.gPredicate = NSPredicate(format: "ANY hasPropertyOf.partOfSpeech == %@", memoPropsSelectIdx)

where memoPropsSelectIdx is an Int16

I also tried

gPredicate = NSPredicate(format: "hasPropertyOf.partOfSpeech == 0") 

then the error is this:

This is already solved

the cause is, there is another NSPredicate initialization that I commented out
to isolate for debugging

but upon testing, it went to a branch that will use the uninitialize predicate

so the runtime error occurred