Hi.
I want to draw a route for more than one location. When I make a request with the following codes, it gives an error after 50 calculations.
Is there such a limit? I did not see it in the documents.
func drawPolyline(coordinates: [CLLocationCoordinate2D]){
let coords= coordinates.count - 1
for i in 1...coords{
let request = MKDirectionsRequest()
let loc1 = coordinates[i - 1]
let loc2 = coordinates[i]
request.source = MKMapItem(placemark: MKPlacemark(coordinate: loc1))
request.destination = MKMapItem(placemark: MKPlacemark(coordinate: loc2))
request.transportType = .automobile
let direction= MKDirections(request: request)
direction.calculate(completionHandler: {
response, error in if error == nil {
let myRoute= response!.routes[0] as MKRoute
self.mkMap.add(myRoute.polyline)
}
})
}
}