0

我有这段代码来更新和保存用户在阵列上的位置现在如何确定用户是否在收费/高速公路上?Swift,MapKit,CLLocation如何避免收费公路

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

回答

1

您可能想试试看MKDirectionsResponse对象。它包含一组MKRoute对象,并且每个MKRoute都有一个advisoryNotices(字符串),其中包含有关该路线的信息。不保证它总是有收费信息,但它可能....