Ho un NSArray che voglio filtrare determinati oggetti usando un NSPredicate, speravo di poter usare NOT in poiché ho visto che posso facilmente fare un IN.NSArray con NSPredicate usando NOT IN
Così ho la mia matrice:
self.categoriesList
tanto sono i valori che voglio per rimuovere:
NSArray *parentIDs = [self.cateoriesList valueForKeyPath:@"@distinctUnionOfObjects.ParentCategoryID"];
Questo mi dà un elenco di ParentCategoryID di per le categorie non voglio per visualizzare, così ho dato posso usare un NSPredicate per rimuoverli:
self.cateoriesList = [self.cateoriesList filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"CategoryID NOT IN %@",parentIDs]];
Questo fallisce:
reason: 'Unable to parse the format string "CategoryID NOT IN %@"'
se volevo usare solo in che funziona perfettamente, naturalmente.
ummm ... sì che funziona - DOH! – Slee
! (CategoryID IN% @) - funziona anche)) –