我有这个代码来更新并保存用户在阵列上的位置现在如何识别用户是否在收费/高速公路上?
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let userLocation: CLLocation = locations[0] as CLLocation
userLocationForDirections = locations[0] as CLLocation
manager.startUpdatingLocation()
var userLatitude = (userLocation.coordinate.latitude)
var userLongitude = (userLocation.coordinate.longitude)
userMoves = [userLatitude, userLongitude]
}
答案 0 :(得分:1)
您可能想尝试查看MKDirectionsResponse
对象。它包含一组MKRoute
个对象,每个MKRoute
都有一个advisoryNotices
(字符串),其中包含有关路径的信息。不能保证它总是有收费信息但它可能......