I'm trying to use coordinates returned using CLLocationManager to see if they are a close match for any local business - if I happened to be standing in a Starbucks for example, I would want my app to suggest that based on my coordinates I was standing in Starbucks. If I was 20 metres outside Starbucks, but it was the closest address to where I was standing, I would want it to suggest 'Starbucks'.
I can return CLPlacemarks no problem, but the information they contain does not contain the business name anywhere. I am in the UK, so, for example, Nando's on the Gloucester Road in London has an address of '170 Gloucester Road, London, SW7 4ST'. I can return 170 Gloucester Road, London, SW7 4ST in the CLPlacemark info no problem, but nowhere does it mention Nando's.
I read in various posts that the info might in the name property, or area of interest or even within the formatted address property, but my extensive testing in Central London suggests that isn't the case, in the UK at any rate. Even in the US, "Apple Inc" is only mentioned within its address's formatted address property before 1 Infinite Loop.
I tried to accomplish this instead by getting the user's coordinates using CLLocation and then using them as a basis for a programmatic MapKit search - this just returns the address again, not a business name.
Having also done a bit of end-user testing of the Apple Maps app, which I am otherwise a huge fan of, it seems to return fairly incomplete results if searching locally generally for e.g. 'bar', 'restaurant'. Some local places are included, others aren't, sometimes the results contain places which are quite far away, even though I know that there are many more restaurants in the immediate vicinity.
I am fast concluding the only way to achieve what I want is to use the Google Places API, which I was hoping to avoid for a number or reasons, not least my considerable lack of experience at iOS programming (in Swift btw...)
If anyone can definitively advise that there is no way to do this natively in Mapkit and that I need to use Google Places API, then at least I know, and can just get on with it - but if there is a way, I would be most grateful to know what it is...
thanks in advance!
I have encounter similar issues with MapKit, and after a while found that Google places API is much better for this kind of task check this link to find sample code on how to use Google Places to get current location
Basically you'll need to
-Install Google places SDK
-Import Google maps to your class
-Add a places client on class
-Init your places client probably on your viewDidLoad()
-And add this code where you need it to search for the current place
You also have the chance to use GMSPlacePicker, which can help a lot if you want your users to hace a chance to pick their current place.