NSLocale *locale = [NSLocale currentLocale];
NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init];
[currencyStyle setLocale:locale];
[currencyStyle setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyStyle setFormatterBehavior:NSNumberFormatterBehavior10_4];
[currencyStyle setCurrencySymbol:[countriesCurrency objectForKey:currency]];
[currencyStyle setRoundingIncrement:[NSNumber numberWithFloat:0.01]];
Since 2012 code like below returned "0.70 €" and that was great as it's exactly what is expected.
po [currencyStyle stringFromNumber:[NSNumber numberWithFloat:0.70]]
BUT since iOS 13 (app build with xCode 10.3, just users with iOS 13 on their iPhones installed app from the AppStore. Same for build throw xCode 11 on iOS 13.0 and 13.1 beta) exactly same code returns "0,69999998435378074 €"
After quick midnight investigations found that if add
currencyStyle.usesSignificantDigits = YES;
then result will be "0.7 €" - much better but still not exactly what was expected ("0.70 €").
Any ideas how to make setRoundingIncrement great again?
[UPDATE]: Rewriting the same code to swift solve the problem but this sounds like temp solution in the case all the rest app is in Obj-C.