I have array of dictionaries like this:
clients (
{
country = canada;
city = vancouver;
},
{
country = Mexico;
city = Mexico;
},
{
country = UK;
city = London;
},
{
country = USA;
city = NewYork;
},
}
Where if I use NSPredicate to find the clients in USA like this:
NSPredicate *usaPredicte = [NSPredicate predicateWithFormat:@"SELF contains %@", @"USA"];
self.usa = [listOfClients filteredArrayUsingPredicate:usaPredicte];
works just fine but if for some reason the result of the predicte is null for example in this case:
NSPredicate *peruPredicte = [NSPredicate predicateWithFormat:@"SELF contains %@", @"Peru"];
self.peru = [listOfClients filteredArrayUsingPredicate:peruPredicte];
I get this error:
-[__NSCFDictionary filteredArrayUsingPredicate:]: unrecognized selector sent to instance 0xdcb6e0
Any of you knows why or how can avoid having this error when the predicate is empty or null?
I'll really appreciate your help