I'm going crazy right now. I have a NSMutableArray with a bunch of Person objects. I want to remove the duplicated objects but it won't work. This is what i got:
NSMutableArray *withoutDoubles =[[NSMutableArray alloc]init];
NSArray *temp = [[NSArray alloc] initWithArray:tempResults];
for (Person *person in temp) {
if(![withoutDoubles containsObject:person]) {
[withoutDoubles addObject:person];
}
}
for (Person *person in withoutDoubles) {
NSLog(@"----> %@",person.name);
}
That is not working, i still got duplicates. I also tried:
NSArray *temp = [[NSArray alloc] initWithArray:tempResults];
NSSet *set = [NSSet setWithArray:temp];
But it didn't work either. I need some help here.
Thanks in advance.