Hi
I want to format a NSDecimalNumber as a Dollars value ($1.50) but Im getting a crash.
This is my method:
+(NSString*) formatPriceForUser:(NSDecimalNumber*)dPrice{
NSNumberFormatter *formatter;
if (!formatter) {
formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setMaximumIntegerDigits:6];
[formatter setMaximumFractionDigits:2];
}
NSString* str = [formatter stringFromNumber:dPrice];
return str;
}
The crash happens on the stringFromNumber invocation.
What am I doing wrong?
Thanks in advance.
Gonso