![](/img/trans.png)
[英]iOS Webkit not working on device, but works on simulator at swift
[英]NumberFormatter works on simulator but not on device swift
你錯了,格式化程序在模擬器和設備上都能正常工作——每個都使用不同的語言環境。 如果這是向用戶顯示的數字,那么在用戶的區域設置中格式化數字是完全正確的。
如果你想在任何地方使用特定的語言環境,你必須明確設置它,例如:
formatter.locale = Locale(identifier: "en_US")
您需要指定formatter.locale
否則NumberFormatter
將從設備獲取默認值。
https://developer.apple.com/documentation/foundation/numberformatter/1416967-locale
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.