Question

Users App Store local region and Locale.current device setting discrepency

  • 10 November 2022
  • 2 replies
  • 362 views

Badge +1

Hey,

I’m formatting price strings that are returned from RevenueCat (localizedPriceString) in my iOS build but I also need access to the users app store region code to format the currency to and from a floating point number while keeping the correct currency formatting before and after.

The number formatter in xcode uses either ‘Locale.current’ (which the user can change in the phone settings leading to possible incorrect formatting) or a manually specified region code. I need the app store region code to ensure the values that I format are returned in the correct currency format.

Is there anyway RC can supply this?

Cheers,

Matt.


2 replies

Badge

Hey Matt,

Will getting the SKStoreFront from the RevenueCat SDK work? The store front object contains a country code that you may be able to use.

No this doesn’t work as I hoped. The country code is not what Locale uses to initialize itself. We need access to the current locale. The store kit 2 product contains that locale but its not passed to us through RevenueCat.

Edit.. you can get the the Locale by using:

`package.storeProduct.sk1Product?.priceLocale`

Userlevel 5
Badge +9

Hey Matt,

Will getting the SKStoreFront from the RevenueCat SDK work? The store front object contains a country code that you may be able to use.

Reply