问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/16212055/detect-country-of-itunes-store-in-ios