2012-09-13 85 views
1

我的應用程序中有一個價格字段。我使用NSNumberFormatter,並使用核心數據存儲和檢索值。它在模擬器上工作正常,但設備上沒有任何顯示。NSnumberFormatter在模擬器上工作,但不在設備上

我也顯示在模擬器上正常工作但不在設備上的本地貨幣值。我用的貨幣下面的代碼:

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

檢查是否相同 – parilogic

+0

沒有,但我在模擬器中更改了語言環境並進行了檢查,結果正常。 – Chandu

+0

模擬器在美國,我的手機的語言環境是印度。 – Chandu

回答

1

印度數制

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百萬行設備現場和仿真語言環境

相關問題