Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching for city names in ios

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?

like image 674
user826955 Avatar asked Feb 15 '12 19:02

user826955


1 Answers

Found a solution:

The geonames webservice and the objective-c client api.

The client api also brings a ready-to-use search controller.

like image 59
user826955 Avatar answered Oct 21 '22 09:10

user826955