Unique ID of MKLocalSearch result?

310 Views Asked by At

My App shows the result of a MKLocalSearch query.

The user can select such a place and say 'I like this place'.

When the user searches again (after closing the App), how can my App know that the user already likes this place?

Is there something in the result that does not depend on the locale (the same at the next search) and unique (not shared by another place at the same location)

        let request = MKLocalSearchRequest()
        request.region = mapView.region
        request.naturalLanguageQuery = query
        let search = MKLocalSearch(request: request)
        search.start { (response, error) in
            // do I know some items in the response?
        }
1

There are 1 best solutions below

1
On

You should get the phone number back as part of the response, which you can use as a unique ID for the location.