简体   繁体   中英

NSnumberFormatter working on simulator but not on device

There is a price field in my App. I used NSNumberFormatter and I am storing and retrieving values using core data. It's working fine on the simulator but nothing is showing up on the device.

I am also displaying the local currency value which is working fine on the simulator but not on the device. I used the following code for the currency:

NSLocale *theLocale = [NSLocale currentLocale];
NSString *a = [theLocale objectForKey:NSLocaleCurrencySymbol];

For Indian Number System

    NSNumberFormatter *frm=[[NSNumberFormatter alloc] init];
[frm setNumberStyle:NSNumberFormatterDecimalStyle];

    [frm setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_IN"] autorelease]];
[frm setCurrencySymbol:@""];

NSString *formattedAmt=[frm stringFromNumber:[NSNumber numberWithDouble:tmpAmt]];

Change LocaleIdentifier to en_US for Millions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM