Determine iPhone user#39;s country(确定 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 用户所在的国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:确定 iPhone 用户所在的国家
基础教程推荐
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01