简体   繁体   English

NSnumberFormatter在模拟器上工作,但不在设备上工作

[英]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. 我使用了NSNumberFormatter,并且正在使用核心数据存储和检索值。 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 将LocaleIdentifier更改为en_US,以百万计

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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