仅从 GPS 获取 iPhone 上的位置 - 而不是 wifi 网络而不是、位置、网络、GPS

2023-09-07 05:00:13 作者:魅

i am creating an app that uses location-

everything works swimmingly except one thing-

iphone6gps功能在哪

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.