iOS8 beta7 NSNumberFormatter bug

I just submitted this bug to Radar, hopefully it's fixed before the imminent RC:

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
numberFormatter.minimumSignificantDigits = 2;
numberFormatter.maximumSignificantDigits = 2;

// on iOS7 this outputs "$123.12"
// but on iOS8 b7 this just outputs "$123"
NSLog(@"%@", [numberFormatter stringFromNumber:@(123.12)]);

I'll have to implement it manually for now, it's fairly nasty:

// bug in iOS8, see here:
+ (NSString *)iOS8CurrencyForAmount:(NSNumber*)number{
#warning remove this once iOS8 nsnumberformatter bug fixed

    NSString *numberString= [NSString stringWithFormat:@"€ %@", number.description];
    NSUInteger length= numberString.length;

    if ([numberString containsString:@"."]){
        // catch when only one significant digit, e.g. 1.2 -> 1.20:
        if ((length-2 > 0) && [[numberString substringFromIndex:length - 2] containsString:@"."]){
            return [NSString stringWithFormat:@"%@0", numberString];
        // no decimal place at all. Just append .00
        return [NSString stringWithFormat:@"%@.00", numberString];

    return numberString;


My bad - the minimumSignificantDigits and maximumSignificantDigits properties don't even need to be set, so if you strip them off then all is right again.