问题
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