3

MKLocalSearch.start is giving me MKErrorGEOError=-8 which is not documented in MKError.

  • This only happens in my CI machine!
  • This only happens when running the tests, the app code works fine
  • I tried enabling location services on macOS just in case, but it didn't work.
  • That machine shouldn't have any network requests/URLs blocked

What fixed for me was to add request.naturalLanguageQuery = "Venue", but I don't understand why, nor why this would fix an error that is happening in only 1 machine.

Does anyone have any information about this?


Here's some sample code:

let request = MKLocalSearch.Request()
request.naturalLanguageQuery = "Venue" // this fixes it, but why?!
let ibereCamargoMuseumCoordinates = CLLocationCoordinate2D(latitude: -30.0777596,
                                                           longitude: -51.2477212)
let span = MKCoordinateSpan(latitudeDelta: 5, longitudeDelta: 5)
request.region = MKCoordinateRegion(center: ibereCamargoMuseumCoordinates, span: span)
if #available(iOS 13.0, *) {
    request.resultTypes = .pointOfInterest
}

let localSearch = MKLocalSearch(request: request)
localSearch.start { response, error in
    ...
}

Here's some debugging output:

(lldb) po error
Error Domain=MKErrorDomain Code=4 "(null)" UserInfo={MKErrorGEOError=-8}

(lldb) po error.userInfo
▿ 1 element
  ▿ 0 : 2 elements
    ▿ key : AnyHashable("MKErrorGEOError")
      - value : "MKErrorGEOError"
    - value : -8

If you're interested I asked this on Apple dev forums too

3
  • 1
    I'm curious what sense it makes to do a natural language query without a .naturalLanguageQuery string.
    – matt
    Commented Apr 6, 2021 at 22:34
  • One possible use case I can see is listing all .pointOfInterest in a region span.
    – henrique
    Commented Apr 7, 2021 at 13:30
  • MKLocalSearch is not made to give you all points of interest in e region. It is made to o let the user search for a natural string like Pizza. Even then, the number of results are limited to 10. Commented Apr 23, 2021 at 22:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.