1

当 CarPlay 连接时,在's方法中返回的speed属性似乎在某些车型上更高。CLLocationCLLocationManagerdidUpdateLocations

这似乎与应用程序中的 CarPlay 导航支持无关,因为演示项目可以在没有 CarPlay 支持的情况下重现该问题。

确认发生这种情况的具体车型是:

  • 沃尔沃 XC90
  • 带 Sync 3 的福特中转
  • 带有 Rlink2 和最新固件的 Renault Megane IV 型号 2018
  • 欧宝雅特站 (2018)
  • 福特福克斯 2017
  • 欧宝 Astra(K 型,2017 年)— 获得一半的 GPS 速度

差异示例:

  • 车速表:120km/h
  • GPS 速度从didUpdateLocations: 115km/h
  • didUpdateLocations在其中一款车型上连接 CarPlay 的GPS 速度: 130 公里/小时

在这里您可以找到重现该问题的演示项目(使用 NL 语言环境): https ://github.com/flitsmeister/carplay-speed-problem

相关部分:

override private init() {
    super.init()

    // These settings mimick the settings we have in our production app
    locationManager.requestAlwaysAuthorization()
    locationManager.delegate = self
    locationManager.allowsBackgroundLocationUpdates = true
    locationManager.activityType = .automotiveNavigation
    locationManager.pausesLocationUpdatesAutomatically = false
    locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.distanceFilter = kCLDistanceFilterNone
}

func startLocating() {
    locationManager.startUpdatingLocation()
}

func stopLocating() {
    locationManager.stopUpdatingLocation()
}

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    guard lastLocation = locations.first else {
        return
    }

    print(lastLocation.speed) // This property is higher when connected to CarPlay
}
4

0 回答 0