Detect at runtime which country's App Store my iPhone app was downloaded from?

江枫思渺然 提交于 2019-11-27 20:41:15

I also think using NSLocale would be the best possible solution for determining the user's country.

Here's how it would be done:

// Get user's country code based on currentLocale
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];

if ([countryCode isEqualToString:@"US"]){
    // US Only
}

However, since there's no guarantee that the user won't change their international settings, you might have no choice but to release separate apps, one for a US audience and another for an international one.

It's either Locale, or different versions for different stores.

To me the Locale option seems like the least amount of work and will probably be correct 95% of the time...

The question is very old, but since others may have the same querying, i'm chipping in :) Given that it's not 'sensibly' possible other than through local retrieval, one mechanism would be through customer registration. In the registration form, you can then ask the country where they are registering from and take it from there...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!