I tried to add a polyline from the user's location to destination by using the following code, I am sure that I have conformed to the delegate and ensure that the user is in authorizedAlway mode in the authorization status. However, the console generated this error message saying "[UserSession] maps short session requested but session sharing is not enabled" I can not find anything related on how to solve this error.
func generatePolyLine(toDestination destination: MKMapItem) {
let request = MKDirections.Request()
//start from the user's current location to find the ride
request.source = MKMapItem.forCurrentLocation()
request.destination = destination
request.transportType = .automobile
let directionRequest = MKDirections(request: request)
directionRequest.calculate { response, error in
if let error = error {
print("Error calculating direction request \(error)")
}
guard let response = response else { return }
self.route = response.routes.first
guard let polyLine = self.route?.polyline else { return }
self.mapView.addOverlay(polyLine, level: .aboveRoads)
}
}