get location on iphone ONLY from the GPS - not the wifi network

前端 未结 6 663
刺人心
刺人心 2021-02-03 13:44

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 o

6条回答
  •  旧巷少年郎
    2021-02-03 14:32

    the inaccurate GPS coordinates are obtained by the iPhone not only via the Wi-Fi or mobile networks, but also the real-coordinates with accuracy level >100 metres.

    What I use is to put the line: if (newLocation.horizontalAccuracy < 0 || newLocation.horizontalAccuracy > 50) return;

    as the first line in the didUpdateToLocation, to filter out inaccurate coordinates.

    The 'location age' i.e. NSTimeInterval locationAge=[locTimestamp timeIntervalSinceNow]; does NOT serve for me to get rid of cached coordinates.

提交回复
热议问题