Swift,MapKit,CLLocation如何避免收费公路

时间:2017-05-30 19:41:05

标签: swift mkmapview mapkit cllocationmanager cllocationcoordinate2d

我有这个代码来更新并保存用户在阵列上的位置现在如何识别用户是否在收费/高速公路上?

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 个答案:

答案 0 :(得分:1)

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