In addition to setting the grouping separator, you need to tell NSNumberFormatter
to use it:
NSNumberFormatter *format = [[NSNumberFormatter alloc] init];
format.locale = [NSLocale currentLocale]; // <<== Don't forget to set the locale
[format setNumberStyle:NSNumberFormatterDecimalStyle];
[format setGroupingSeparator:@","];
[format setGroupingSize:3];
format.usesGroupingSeparator = YES; // <<== Add this line
This should produce the number with comma separators.