NSPredicates with custom objects

Posted by Horatiu Paraschiv on Stack Overflow See other posts from Stack Overflow or by Horatiu Paraschiv
Published on 2010-04-05T22:42:25Z Indexed on 2010/04/05 23:13 UTC
Read the original article Hit count: 375

Hi, I have the following problem and I cannot figure out how to solve it. I have an NSSet which contains Person objects (NSDictionary with 2 keys: name, age). From time to time I get an NSArray of Person objects and I want to add them to my NSSet but I want to filter out the duplicates. I'm thinking I could use NSPredicates but I am reading the documentation and I can't understand how should I format my NSPredicate to filter out my array content based on what I already have in NSSet.

So I have an NSSet with 5 custom objects and I get an NSArray with 6 objects but 3 of them already exist in NSSet and I want to filter them out. I understand what I should do with basic objects like Strings, integers, etc but I don't know how to extend this to work with custom more complex objects.

I hope I was clear enough with my problem. Any starting point, example or advice is much appreciated.

Thank you!

© Stack Overflow or respective owner

Related posts about iphonecoredatarecipes

Related posts about nsset