MKLocalSearch produces MKMapItems with no URL

169 views Asked by At

I have an app that relies on the url property of the MKMapItem class.

In the past (as recently as a few months ago) I was able to do a local search for any US city and receive an MKMapItem instance which contained a URL for that location, such as a Wikipedia URL.

For some reason this appears to be broken now and all the MKMapItem instances returned by MKLocalSearch contain a nil URL. Here's my code:

let request = MKLocalSearchRequest()

// Replace with any city, like "San Francisco, CA"
request.naturalLanguageQuery = "Seattle, WA"

// Start the local search.
MKLocalSearch(request: request).start { (response, error) in

    // Omitting error handling for brevity.
    let mapItems = response?.mapItems {
        for mapItem in mapItems {
            // mapItem.url is always nil here!!
        }
    }
}

I've submitted a code-level support ticket, since this absolutely used to work just fine. Will post here when I hear back. In the meantime, has anyone else ran into this issue?

1

There are 1 answers

0
Yuri Brigance On

Appears to be a MapKit bug. I've submitted a bug report with Apple.