iOS iTunes store country

Viewed 3690

i am wondering if there is a solution to find out, in which country the user downloaded an application.

For example: app x has been downloaded in USA when the user opens up the app, the app will check in which country it was downloaded. In this example the the return would be "USA"

Does any one hase an idea on how to solve this?

4 Answers

SKStoreFront, introduced in iOS 13 SDK seems to do the job.

Swift

if let storefront = SKPaymentQueue.default().storefront {
    print(storefront.countryCode) // Returns an Alpha-3 country code (USA, GBR etc.)
}

Obj C

[SKPaymentQueue defaultQueue].storefront.countryCode; // Returns an Alpha-3 country code (USA, GBR etc.)

You should be able to access the SKStoreFront instance by adding the StoreKit framework to your project, even if your app does not offer any purchases.

Related