![](/img/trans.png)
[英]iphone NSNumberFormatter work on simulator not on device os 4.2 while parsing
[英]NSnumberFormatter working on simulator but not on device
我的應用程序中有一個價格字段。 我使用了NSNumberFormatter,並且正在使用核心數據存儲和檢索值。 在模擬器上工作正常,但設備上沒有任何顯示。
我還顯示了本地貨幣值,該值在模擬器上可以正常運行,但在設備上無法正常運行。 我使用以下代碼表示貨幣:
NSLocale *theLocale = [NSLocale currentLocale];
NSString *a = [theLocale objectForKey:NSLocaleCurrencySymbol];
對於印度數字系統
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]];
將LocaleIdentifier更改為en_US,以百萬計
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.