gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 13:28:39 26 4
gpt4 key购买 nike

我的应用程序中有一个价格字段。我使用了 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 for Millions

关于iphone - NSnumberFormatter 在模拟器上工作但不在设备上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12406500/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com