I am developing applications for recording routes using MapKit. I use the following code to display the saved route on the map:
let polyline = MKPolyline(coordinates: coordinates, count: coordinates.count)
polyline.title = title
polyline.subtitle = subtitle
mapView.addOverlays([polyline])
Everything works fine when the device has an Internet connection and the map data is available and downloaded. However, when there is no connection, only the current position and annotations are displayed on the map. MKPolyline is displayed only on the part of the map for which the data has been loaded (see screenshot).
How can this be fixed?