get location on iphone ONLY from the GPS - not the wifi network(仅从 GPS 获取 iPhone 上的位置 - 而不是 wifi 网络)
问题描述
i am creating an app that uses location-
everything works swimmingly except one thing-
when i come home my iphone connects to my local wifi network and instead of getting my location using the gps in the phone it tries to get it by figuring out where my wifi network is connected to- if i turn my wifi off it keeps an accurate location point-
as soon as my phone is connected to my wifi network it starts telling me my location is several km/miles from my actual point.
i would like my app NOT to use the wifi network to try get my location-
is there a way i can- a. tell if a location point has been derived from the GPS so i can ignore locations derived from the wifi network. b. stop location services jumping over to wifi for location
Well I did some playing around
Found some apple documentation that says that [location verticalAccuracy]
REQUIRES a device with gps.
So I stuck this code in (abridged) and based on the limited testing I have done, it appears to be doing what I want:
if (([location horizontalAccuracy] > 0) && ([location verticalAccuracy] > 0)){
//report location here
}
Thanks all for your replies.
这篇关于仅从 GPS 获取 iPhone 上的位置 - 而不是 wifi 网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:仅从 GPS 获取 iPhone 上的位置 - 而不是 wifi 网络
基础教程推荐
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01