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?
If you have any In-App Purchases available, you can read the locale from the SKProduct. As a fallback, use the device's locale.
NSLocale *locale;
SKProduct *baseProduct = nil; // replace as applicable
if (baseProduct) {
locale = baseProduct.priceLocale; // from the user's credit card on iTunes
} else {
locale = [NSLocale currentLocale]; // from user preferences
}
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
NSLog(@"Two-letter country code: %@", countryCode);
There might be a good enough correlation between the iTunes store country and the locale a user sets. This depends on your needs - if this does not suffice, I don't think there is a way to know which actual store an app was downloaded from.
To retrieve that locale, you could use:
NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
Hope this is sufficient for your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With