iPhone定位错误?

时间:2016-11-08 06:25:28

标签: ios cllocationmanager

我正在运行Xcode 8.1和iOS 10.0

我注意到在运行iOS模拟器且位置设置为City Run时,前三个位置无序。这是一个例子。

<+37.32733927,-122.01971962> +/- 30.00m (speed 3.57 mps / course 177.33) @ 11/8/16, 2:12:42 AM Atlantic Standard Time
<+37.32733927,-122.01971962> +/- 30.00m (speed 3.57 mps / course 177.33) @ 11/8/16, 2:12:38 AM Atlantic Standard Time
<+37.32733927,-122.01971962> +/- 30.00m (speed 3.57 mps / course 177.33) @ 11/8/16, 2:12:42 AM Atlantic Standard Time
<+37.32461541,-122.01985035> +/- 5.00m (speed 3.53 mps / course 276.46) @ 11/8/16, 2:14:01 AM Atlantic Standard Time
<+37.32461920,-122.01989178> +/- 5.00m (speed 3.86 mps / course 281.73) @ 11/8/16, 2:14:02 AM Atlantic Standard Time
<+37.32462267,-122.01993478> +/- 5.00m (speed 3.86 mps / course 281.73) @ 11/8/16, 2:14:03 AM Atlantic Standard Time

它们都具有相同的位置,准确性,速度和路线。第一个和第三个具有相同的时间戳,晚于第二个。第四个到最后(无论我让位置跟踪运行多久),都有意义(每个都有不同的属性,时间戳增加)。

我所有与位置相关的代码都是:

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    for newLocation in locations {                        
        // Add location to model
        model.append(newLocation)
        let totalDistance = Measurement<UnitLength>(value: model.totalDistance, unit: .meters)
        distanceLabel.text = totalDistance.description
        debugPrint(newLocation)
    }
}
我的模型类中的

和我的append(_:)

func append(_ location: CLLocation) {
    if let oldLocation = _locations.last {
        _totalDistance += location.distance(from: oldLocation)
    }
    _locations.append(location)
}

编辑:这也发生在设备上。有没有其他人注意到这一点?我无法回想起iOS 10之前发生的事情。

0 个答案:

没有答案