CLLocationManagerDelegate具有错误的时间戳

时间:2017-05-06 14:39:27

标签: ios swift cllocationmanager cllocation

我已经实施了一个在后台工作24小时的跟踪应用程序。有时我注意到时间戳和位置不匹配。例如。如果我乘汽车或火车旅行,我记录的距离为50公里且准确度< 2公里,而时间戳相差6分钟。

那么如何确保数据正确无误?

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {}  

目前我按照准确度对位置进行排序,并且只记录最佳位置。仅采取最后一个更好吗?还是全部?

以下是我设置locationmanager的方法:

private func setupLocationManager() {

           self.locationManager.delegate = self
           self.locationManager.requestAlwaysAuthorization()
           self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
           self.locationManager.distanceFilter = 300
           self.locationManager.pausesLocationUpdatesAutomatically = false
           self.locationManager.allowsBackgroundLocationUpdates = true
           self.locationManager.activityType = .other
    }

我在一个单独的类中执行此操作,而不是在AppDelegate中。这个类存在于我的appdelegate中的实例变量中。

0 个答案:

没有答案
相关问题