确定 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 用户所在的国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Facebook Requests Dialog: Frictionless Requests in native iOS app possible?(Facebook 请求对话框:本机 iOS 应用程序中的无摩擦请求可能吗?)
Difference between iPhone Simulator and Android Emulator(iPhone模拟器和Android模拟器之间的区别)
iOS 6 (iPhone/iPad) Image Upload quot;Request Body Stream Exhaustedquot; with NTLM/Windows Authentication(iOS 6 (iPhone/iPad) 图片上传“请求正文流用尽使用 NTLM/Windows 身份验证)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中删除 Safari 中的地址栏?)
Having trouble creating UIImage from CIImage in iOS5(在 iOS5 中从 CIImage 创建 UIImage 时遇到问题)
Get list of all photo albums and thumbnails for each album(获取所有相册的列表和每个相册的缩略图)