添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
有腹肌的排球  ·  Kaggle ...·  5 月前    · 
谈吐大方的跑步鞋  ·  GitHub - ...·  6 月前    · 
在iOS13上我使用如下代码来转换本地化的价格,但是在iOS14上它不起作用,显示的价格总是以美元的数值和单位来显示
  • (NSString *)getLocalePrice:(SKProduct *)product {

if (product) {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:product.priceLocale];

return [formatter stringFromNumber:product.price];
}
return @"";
}

我不明白这是为什么,代码没变,在iOS13之前是正常的,但是iOS14之后的效果却不一样,上面代码的 product.priceLocale 换成 [NSLocale currentLocale],时也只是改变了货币符号,但是货币的数值没有改变?($3.99 -> ¥3.99),这是为什么?
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Developer Forums Participation Agreement and Apple provided code is subject to the Apple Sample Code License .
  • Forums
  • Terms of Use Privacy Policy License Agreements