This is my code for getting the local price and currency symbol.
private func getLocalCurrencyAndPrice(from product: SKProduct) -> (currency: String, price: Double) {
//Get the currency
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .currency
numberFormatter.locale = product.priceLocale
let priceString = numberFormatter.string(from: 0)
let currencyString = ((priceString?.replacingOccurrences(of: "0", with: ""))?.replacingOccurrences(of: ".", with: ""))?.replacingOccurrences(of: ",", with: "")
let trimmedCurrency = currencyString?.trimmingCharacters(in: .whitespacesAndNewlines)
//Get the price
let price = (product.price.doubleValue).roundToDecimal(2)
return (currency: trimmedCurrency ?? "", price: price)
}
And this is how I am getting separate values:
let currency = getLocalCurrencyAndPrice(from: product).currency
let price = getLocalCurrencyAndPrice(from: product).price
I have created sandbox users for different App Store regions from the App Store Connect. It shows almost all regional prices and currency symbols perfectly except for Indonesia, Taiwan & Korea.
For Indonesia, on the "App Store Connect" It is showing Rp
as their currency symbol: (Please ignore the differences in currency amount for now for all 3 countries)
But on the application, it is showing IDR
:
For Taiwan, on the "App Store Connect" & on the application, It is showing $
as their currency symbol:
But on the "Settings > App Store > Sandbox User > Manage" & "Purchase Pop-Up view", it is showing NT$
as their currency symbol:
For Korea, on the "App Store Connect", "Settings > App Store > Sandbox User > Manage" & "Purchase Pop-Up view", It is showing ₩
as their currency symbol:
But on the application, it is showing ₩
with a double line:
Why these mismatches are showing while I am getting the value from the same source? What have I done wrongly?