gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 15:35:56 26 4
gpt4 key购买 nike

我有这段代码可以更新和保存用户在数组中的位置,现在我如何确定用户是否在收费公路上?

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(字符串)。不能保证它总是有通行费信息,但它可能......

关于Swift、MapKit、CLLocation如何避开收费公路,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44270624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com