从GPS获取iPhone上的位置 - 而不是无线网络 [英] get location on iphone ONLY from the GPS - not the wifi network

查看:101
本文介绍了从GPS获取iPhone上的位置 - 而不是无线网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个使用位置的应用程序 -



一切都在顺利运作,除了一件事情 -

我回到家里我的iphone连接到我的本地wifi网络,而不是让我的位置使用手机中的GPS,它试图通过计算出我的WiFi网络连接位置来获取它 - 如果我关闭它的无线网络,它会保持一个准确的位置点 -



只要我的手机连接到我的wifi网络,它就开始告诉我我的位置离我的实际点有几公里/英里。



我希望我的应用程序不要使用wifi网络来获取我的位置 -



有没有办法可以 -
a。告诉如果一个位置点已经从GPS派生,所以我可以忽略从WiFi网络派生的位置。
b。停止位置服务跳转到无线网络位置

解决方案

嗯,我做了一些玩耍



找到一些苹果文档,说 [location verticalAccuracy] 需要一个带有gps的设备。

所以我坚持这个代码(删节),并基于我所做的有限测试,它似乎是做我想做的:

 <$ c $如果(([[location horizo​​ntalAccuracy]> 0)&&([location verticalAccuracy]> 0)){
//在此处报告位置
}

感谢您的回复。


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上的位置 - 而不是无线网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆