NSMutableArray - Remove duplicates

user393273 picture user393273 · Oct 7, 2010 · Viewed 20.4k times · Source

i tried doing this: Values = [[NSSet setWithArray:Values] allObjects]; and no sucess,

Thanks

Answer

kennytm picture kennytm · Oct 7, 2010

Your method should work, except it returns an NSArray instead of NSMutableArray. You could use

[values setArray:[[NSSet setWithArray:values] allObjects]];

to set values to the content of the new array.