13

In my iPhone app I would like to detect the country of iTunes Store the iPhone user is logged into, e.g. for a user from USA I would like to direct him/her to: https://itunes.apple.com/us/album/21/id420075073 and for a user who is logged into the Polish iTunes Store I would like to redirect him to: https://itunes.apple.com/us/album/21/id403037872

I know that I could check the locale (e.g. the language),but it might not always work.

Any ideas how to achieve this?

Jakub
  • 3,129
  • 8
  • 44
  • 63
  • By it might not always work means ? what problem you faced ? – Janak Nirmal Apr 25 '13 at 10:15
  • I meant that a user can have the language set to English but be logged into Polish iTunes Store, so checking the locale would not give me good result. – Jakub Apr 25 '13 at 11:09
  • I'm also interrested in this as it could potentially be used to reduce *some* patent-trolls problems. User is from a country with a known patent-troll parasite infestation (Lodsys anyone)? Dynamically disable that feature for that country without requiring a build per country. –  May 16 '13 at 20:12

1 Answers1

-3
NSString *countryCode = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode];

will get you an identifier like e.g. "US" (United States), "ES" (Spain), etc.

Because you find country means no problem. We hope the iTunes store must be Device country.

plaes
  • 31,788
  • 11
  • 91
  • 89
  • As I said in my question I knew I could check the locale, however, one could have language set to English but be logged into Polish iTunes Store. – Jakub Apr 25 '13 at 11:08
  • It doesn't answer the question at all. – RomanN Nov 28 '13 at 07:39