iOS: FilterUsingPredicate on custom objects
Posted
by
AppleDeveloper
on Stack Overflow
See other posts from Stack Overflow
or by AppleDeveloper
Published on 2012-12-16T23:01:05Z
Indexed on
2012/12/16
23:03 UTC
Read the original article
Hit count: 424
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]];
© Stack Overflow or respective owner