I have added MapKit in my app. I have connected MKmapview to my viewcontroller by IBOUTLET, it runs fine in simulator but it crashes in my device with this
[LogMessageLogging] 6.1 Unable to retrieve CarrierName. CTError: domain-2, code-5, errStr:((os/kern) failure).
I am taking user's location from CLLocationmanager and trying to add annotation in the map. Code is as below:
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let userLocation:CLLocation = locations[0] as CLLocation
let coordinate = CLLocationCoordinate2D(latitude: userLocation.coordinate.latitude, longitude: userLocation.coordinate.longitude)
MD_myCurrentLocation = coordinate
setupLocationMarker(coordinate:coordinate)
manager.stopUpdatingLocation()
}
func setupLocationMarker(coordinate: CLLocationCoordinate2D) {
iosMap.removeAnnotations(iosMap.annotations)
let span = MKCoordinateSpanMake(0.01, 0.01)
let region = MKCoordinateRegion(center: coordinate, span: span)
iosMap.setRegion(region, animated: true)
let annotation = MKPointAnnotation()
annotation.coordinate = coordinate
iosMap.addAnnotation(annotation)
}