iOS: FilterUsingPredicate on custom objects
- by AppleDeveloper
I have a custom class extending NSObject. I am maintaining NSMutableArray of this class objects. Here is the situation,
customObject {
NSString *name;
int ID;
.....and many other properties;
}
customObjectsArray {
customObject1,
customObject2,
...etc
}
Now I am trying to use filterUsingPredicate to remove objects that has nil names, like below but it returns very few or none objects while I know that there are hundreds of objects that has name not nil or empty. Could someone please tell me what could be wrong here.
[customObjectsArray filterUsingPredicate:[NSPredicate predicateWithFormat:@"name != nil]];