I have a problem with MapKit’s point of interest search in SwiftUI, and the request result shows ErrorDomain =MKErrorDomain Code=5 “(null)” UserInfo={MKErrorGEOError=-10}, I don’t know how to solve it。
private func locationSearch(_ region:CLLocationCoordinate2D,_ span:MKCoordinateSpan) {
let request = MKLocalPointsOfInterestRequest(coordinateRegion: MKCoordinateRegion(center: region, latitudinalMeters: 0.00001, longitudinalMeters: 0.00001))
request.pointOfInterestFilter = .includingAll
// let request = MKLocalPointsOfInterestRequest(center: region, radius: 1000)
let search = MKLocalSearch(request: request)
if search.isSearching { return }
search.start { response, error in
if let error = error {
// Error Domain=MKErrorDomain Code=5 "(null)" UserInfo={MKErrorGEOError=-10}
return
}
guard let response = response else {
return
}
models += response.mapItems
}
}
I tried to delete and recompile, but nothing worked, location permissions were all right, and using MKLocalSearch directly was fine.
New contributor
臧志明 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.