I am using MapKit
to show two annotations and distance between them. Everything works fine but I keep getting this error on the console.
MobileGestalt.c:1647: Could not retrieve region info
Anybody knows what is causing it? Could it be some permission in the .plist
file
Here is full console output:
2019-11-10 00:21:41.419108+0100 Post DACH[20420:264466] Metal API Validation Enabled
2019-11-10 00:21:41.567416+0100 Post DACH[20420:264466] libMobileGestalt MobileGestalt.c:1647: Could not retrieve region info
My code:
struct MapView: UIViewRepresentable {
var requestLocation: CLLocationCoordinate2D
var destinationLocation: CLLocationCoordinate2D
private let mapView = WrappableMapView()
func makeUIView(context: UIViewRepresentableContext<MapView>) -> MKMapView {
mapView.delegate = mapView
return mapView
}
func updateUIView(_ uiView: MKMapView, context: UIViewRepresentableContext<MapView>) {
let requestAnnotation = MKPointAnnotation()
requestAnnotation.coordinate = requestLocation
requestAnnotation.title = "Package"
uiView.addAnnotation(requestAnnotation)
let destinationAnnotation = MKPointAnnotation()
destinationAnnotation.coordinate = destinationLocation
destinationAnnotation.title = "Destiantion"
uiView.addAnnotation(destinationAnnotation)
let sourcePlacemark = MKPlacemark(coordinate: requestLocation)
let destinationPlacemark = MKPlacemark(coordinate: destinationLocation)
let directionRequest = MKDirections.Request()
directionRequest.source = MKMapItem(placemark: sourcePlacemark)
directionRequest.destination = MKMapItem(placemark: destinationPlacemark)
directionRequest.transportType = .automobile
let directions = MKDirections(request: directionRequest)
directions.calculate { (response, error) in
guard let directionResponse = response else {
if let error = error {
print(error.localizedDescription)
}
return
}
let route = directionResponse.routes[0]
uiView.addOverlay(route.polyline, level: .aboveRoads)
let rect: MKMapRect = route.polyline.boundingMapRect
uiView.setVisibleMapRect(rect, edgePadding: .init(top: 50.0, left: 50.0, bottom: 50.0, right: 50.0), animated: true)
}
}
}
Could not retrieve region info
– Madson