difference between desiredAccuracy and distanceFilter

偶尔善良 提交于 2019-12-21 04:16:07

问题


Sorry for being a noob here. I am not able to clearly differentiate between CLLocationManager's properties distanceFilter and desiredAccuracy.

If I want my application to give different coordinates for even small distances (say 100-200 metres) what values should i set for these properties.

Help would be greatly appreciated.


回答1:


According to developer.apple.com

distanceFilter

The minimum distance (measured in meters) a device must move laterally before an update event is generated.

That means, based on previous location event, another location update will only be received after exceeding distanceFilter value distance.

desiredAccuracy refers to how accurate your location data should be. For example if you wish to see the exact street you're on you a high accuracy value for this parameter. (kCLLocationAccuracyBest) If you only wish to see the approximate area (such as in which neighbourhood you're in) you'd set a lower accuracy value for this param. (kCLLocationAccuracyThreeKilometers)

Choose this to suit your needs, however be aware that the more precise you wish to be and the more often you request updates, the more power it will drain from your device.

Hope this helps, Vlad




回答2:


distanceFilter - this is minimal distance which device should pass from previous location which was passed to delegate with ...didUpdateToLocation:... method. And as soon as distance reached location service will invoke ...didUpdateToLocation... again and so on.

desiredAccuracy - tells to location service how accurate coordinate you want and this is minimal location error radius. If value is very low (ex. 5) radio will try to use GPS hardware and will keep powering it up hardly to make it give most accurate location. If value is large,than system may decide to use data which was retrieved from WiFi hotspots location triangulation.



来源:https://stackoverflow.com/questions/6979319/difference-between-desiredaccuracy-and-distancefilter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!