I have an application that uses ObjectiveResource and has a class that contains NSNumber properties. I am trying to format the NSNumber values as integers, and have the following code:
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
NSLog(@"Price: %@", [formatter stringFromNumber:self.item.price])
NSLog(@"Price: %@", [formatter stringFromNumber:[NSNumber numberWithDouble:[self.item.price doubleValue]]]);
[formatter release];
Which outputs:
2010-07-15 19:33:45.371 Sample[4193:207] alcohol: (null)
2010-07-15 19:33:45.453 Sample[4193:207] alcohol: $13.50
I'm not sure why the first item is outputting (null), yet the second works fine. I'd prefer to use the syntax from the first, and not have to re-create a NSNumber.