Swift、MapKit、CLP如何避开收费公路

Swift、MapKit、CLP如何避开收费公路,swift,mkmapview,mapkit,cllocationmanager,cllocationcoordinate2d,Swift,Mkmapview,Mapkit,Cllocationmanager,Cllocationcoordinate2d,我现在有这个代码来更新和保存用户在数组中的位置。我如何识别用户是否在收费/高速公路上 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let userLocation: CLLocation = locations[0] as CLLocation userLocationForDirections = locations[0] as

我现在有这个代码来更新和保存用户在数组中的位置。我如何识别用户是否在收费/高速公路上

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]
    }

您可能需要尝试查看
MKDirectionsResponse
对象。它包含一个
MKRoute
对象数组,每个
MKRoute
都有一个
advisoryNotices
(字符串),其中包含有关路由的信息。不保证它总是有通行费信息,但它可能