I want to have a simple NSSet which is loaded with some NSNumbers and then find out if those numbers are already added in the set or not. When I do this:
NSMutableSet *set = [[NSMutableSet alloc] init];
NSNumber *num1 = [NSNumber numberWithInt:5];
NSNumber *num2 = [NSNumber numberWithInt:5];
[set addObject:num1];
if([set member:num2]){
// something...
}
The problem is that the member always returns nil (if is false), even if those numbers are same. isEqual method returns true. So
if([num1 isEqual:num2]){
// correct
}
works...
In docs I read that member method uses isEqual so I don't know what the problem is...
Thanks for any advice.