Search code examples
iosgeocodingmklocalsearch

how to get Geocoding search results like iOS Maps


I wonder how a request looks like or which class is used to get results like searching with Apple Maps? I've tried:

[geocoder geocodeAddressString:text
                 completionHandler:^(NSArray *placemarks, NSError *error)

that only seems to give back one result.

   MKLocalSearch *search = [[MKLocalSearch alloc] initWithRequest:request];
[search startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error)

that gives back like local stores etc.

How can I get back results like if you type a few letters and you get back the 10 best matching cities?


Solution

  • Its the way as described above. In the end I used Google Maps API search to get the top 10 results that I was looking for.