2

I'm trying to get the business name from a CLLocation. I am able to get the exact street address by reverse geocoding the CLLocation, but am unable to get the name of the business, as the name property on CLPlacemark is just the address.

I have tried:

  • Accessing the name property on CLPlacemark: returns street address
  • Accessing the areasOfInterest property on CLPlacemark: returns nil
  • Using MKLocalSearchCompleter with the query set to the street address returns street address
  • Using MKLocalSearch with the query set to the street address returns nothing

What's strange is that the Apple Maps app allows you to search for the street address and the business name will come up for most locations (and use the address as a fallback, as seen here), but I cannot replicate this feature with the exposed API's. Is what I'm wanting simply not possible with MapKit?

CLGeocoder().reverseGeocodeLocation(location, completionHandler: { (placemarks, error ) in
            guard let placemarks = placemarks else {
                fatalError("Error: failed to reverse geocode location. \(error?.localizedDescription ?? "")")
            }


            for placemark in placemarks {
                print(placemark.name)
            }

            // Do something to get the *true* placemark name.
        })
soysauce44
  • 41
  • 4
  • Likely duplicate of https://stackoverflow.com/questions/35566325/looking-for-business-name-information-from-coordinates-using-cllocation-and-or-m and similar – matt Apr 21 '19 at 18:17

0 Answers0