I want to provide a user-input field in my iPad app, where the user can type the name of a city or location, and the app should present a list of possible cities/locations where the user can select from, and I can get the geo coordinates from (to add markers on a MKMapView
).
I tried CLGeocoder
, but it seems it only gets me one result, plus the result ain't that accurate. For example, putting "Stutt" as address string yields "Straubing, germany" as result, wheareas "Stuttgart" will bring up "Stuttgart" (correct) as result (I would thus expect at least 2 results for "Stutt"). Also, theres a city called stuttgart in the US, which also was not given as result.
(i used the sample code on the very bottom of this page: https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders.html)
Can anyone guide me to a proper solution for city name/location lookup based on user text input?
Found a solution:
The geonames webservice and the objective-c client api.
The client api also brings a ready-to-use search controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With