确定 iPhone 用户所在的国家

Determine iPhone user#39;s country(确定 iPhone 用户所在的国家)
本文介绍了确定 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 用户所在的国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)
HTTPS request using volley(使用 volley 的 HTTPS 请求)