想要从didUpdateLocations内部更改当前CLLocationManager的距离过滤器。没有变化。
override func viewDidLoad()
{
super.viewDidLoad()
...
self.locManager = CLLocationManager()
if (self.locManager.respondsToSelector(Selector("requestAlwaysAuthorization")))
{
self.locManager.requestAlwaysAuthorization()
}
if CLLocationManager.locationServicesEnabled()
{
self.locManager.delegate = self
self.locManager.desiredAccuracy = kCLLocationAccuracyBest
self.locManager.distanceFilter = Double(100)
self.locManager.startUpdatingLocation()
}
...
}
根据设备速度和其他属性在didUpdateLocations中更改desiredFilter。
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!)
{
...
self.locManager.distanceFilter = Double(desiredFilter)
...
}