确定iPhone用户的国家 [英] Determine iPhone user's country

查看:88
本文介绍了确定iPhone用户的国家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在启动时确定用户所在的国家/地区,以用于iPhone应用程序。据推测,我将不得不打开位置服务并进行某种反向地理编码。如果可能的话,我真的不想使用第三方网络服务,还有其他建议可以从服务提供的位置来确定国家吗?

最初,我只需要以检查用户是否在美国境内,但这可能会在未来增加更多的国家。我了解,该位置不能总是确定,或者用户可能已关闭位置服务。基本上,我只需要知道用户是否被检测到在美国境内,以关闭特定功能。

编辑:在进一步阅读,它看起来像像MKReverseGeocoder将是要走的路,除了我不希望在我的应用程序中显示任何地图,这意味着我不允许使用它。

解决方案

鉴于MKReverseGeocoder的限制,对我来说,实现我所追求的唯一可行的方式是使用第三方服务来执行反向地址解析。我选择了 GeoNames ,因为它们似乎是标准选择。


I need to determine at startup what country a user is in, for an iPhone application. Presumably I will have to turn on location services and do some sort of reverse geocoding. I don't really want to use a third party web service if possible, are there any other suggestions for determining country from what location services provides?

Initially, I only need to check whether the user is inside the US or not, but this may change in the future to add more countries. I understand that location can not always be determined or the user may have location services turned off. Basically, I just need to know if the user is detected as being inside the US, in order to turn off a specific feature.

EDIT: On further reading, it looks like MKReverseGeocoder would be the way to go, except I don't wish to display any maps in my app, which means I'm not allowed to use this.

解决方案

Given the restrictions of MKReverseGeocoder, it seems the only feasible way for me to achieve what I am after is to use a third party service to perform a reverse geocode. I have chosen to go with GeoNames as they seem to be the standard choice.

这篇关于确定iPhone用户的国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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