在iOS中检测iTunes Store的国家/地区 [英] Detect country of iTunes Store in iOS

查看:141
本文介绍了在iOS中检测iTunes Store的国家/地区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序中,我想检测iPhone用户登录的iTunes Store的国家/地区,例如对于来自美国的用户,我想指导他/她:$ b​​ $ b https: //itunes.apple.com/us/album/21/id420075073
,对于登录波兰iTunes商店的用户,我想将其重定向到:
https://itunes.apple.com/us/album/21/id403037872

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?

推荐答案

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

会为您提供一个标识符,例如: US(美国),ES(西班牙)等。

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

因为你发现国家意味着没问题。我们希望iTunes商店必须是设备国家。

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

这篇关于在iOS中检测iTunes Store的国家/地区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆