代码很简单:
static NSNumberFormatter *numberFormatter = nil;
if (numberFormatter == nil) {
numberFormatter = [[NSDateFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
}
但是,它在最后一行崩溃:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDateFormatter setNumberStyle:]: unrecognized selector sent to instance 0x5c378d0'
这怎么可能?