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

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

问题描述

对于 iPhone 应用程序,我需要在启动时确定用户所在的国家/地区.大概我将不得不打开位置服务并进行某种反向地理编码.如果可能的话,我真的不想使用第三方网络服务,是否有任何其他建议可以根据位置服务提供的内容来确定国家/地区?

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.

在进一步阅读中,看起来 MKReverseGeocoder 将是可行的方法,但我不希望在我的应用程序中显示任何地图,这意味着我不允许使用它.

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.

推荐答案

鉴于 MKReverseGeocoder 的限制,我想实现我所追求的唯一可行的方法是使用第三方服务执行反向地理编码.我选择使用 GeoNames,因为它们似乎是标准选择.

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天全站免登陆