【发布时间】:2020-10-07 21:12:09
【问题描述】:
自从我安装了 Xcode 12 后,我发现我的 IAP 仅根据我的设备设置以美元而不是英镑显示价格。基于 Xcode 11 和之前构建的应用程序在我的设备上正确显示以英镑为单位的价格,而我在 Xcode 12 上构建的任何内容仅以美元显示。显示价格的代码是:
let firstProduct = response.products[0] as SKProduct // there is only 1
// Get its price from iTunes Connect
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .currency
numberFormatter.locale = firstProduct.priceLocale
self.priceField.text = numberFormatter.string(from: firstProduct.price)
其中 priceField 只是屏幕上的 UILabel。自 Xcode 12 起,priceField.text 的值始终显示为 4.99 美元。使用的设备是英国 iPhone 8、英国英语和英国商店设置。如果我从商店下载当前发布的应用程序版本,那么它会正确显示为 4.99 英镑。在 Xcode 12 中调试 firstProduct.priceLocale.regionCode 返回“US”。
我在 Xcode 中找不到任何设置来设置/覆盖该区域,所以我不知道它从哪里得到这个。可能发生了一些我在文档中找不到的变化?
提前致谢!
【问题讨论】:
-
我也注意到了这一点。 TestFlight 和我的应用程序的发布版本播下了正确的本地化价格。
-
我相信模拟器的语言环境设置为 en_US,这意味着除非您更改模拟器语言环境,否则美国价格将显示在那里。
-
谢谢@Paulw11,我会检查一下
-
@Paulw11 我通过在试飞中上传应用程序进行了检查,但对于运行 iOS 14.4 的英国 iPhone,它仍然显示 $
-
定价取决于 iTunes 帐户所在的国家/地区。还要记住,TestFlight 购买不是真正的购买——它们不计费
标签: ios swift xcode in-app-purchase