iOS programming - how to discover from which (country's) app store the app was downloaded
Asked Answered
S

1

7

As you iOS devs know, you can only set one price tier for your app and in-app products in the app store. However, you can (theoretically) publish it as separate apps in different countries with different prices. I would like to do the same with in-app products of the same app - define alternative in-app products, and control their visibility in the app depending on user's country. I don't want to use NSLocale or NSTimeZone because they can be changed in settings. I want to know the country that the app store / user is connected to.

For example, I want to offer an auto-renewing subscription for most users, but I know that auto-renewing subscriptions are not available in the Israeli app store, so I want to show a non-renewing subscription exclusively to Israeli users, and not show them the auto-renewing one. Is there a reliable way of achieving this?

Thanks, Avi

Straiten answered 8/7, 2013 at 9:40 Comment(0)
S
5

After investigating further, I discovered that when querying products in store-kit, SKProduct returns with a property named priceLocale, which consists of the country code and currency code. The country code of priceLocale seems to be consistent with the user's app store.

To sum up, doing these steps will get the result, however in a slow and not straightforward way:

  1. Define an in-app item;
  2. Query that item in your app;
  3. Determine user's country according to [product.priceLocale objectForKey:NSLocaleCountryCode];
  4. Show the user the relevant products your app supports in their country.
Straiten answered 9/7, 2013 at 7:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.