MKLocalSearch

MKLocalSearchRequest takes a naturalLanguageQuery, such as “Taxidermists”, and an optional bounding geographic region to constrain results. In practice, the region is usually passed from an MKMapView.

MKLocalSearchResponse is returned in the eponymous block handler of MKLocalSearch -startWithCompletionHandler:, and returns an array of MKMapItem objects. Each MKMapItem contains information like name, phoneNumber, url and address information via the placemark property.

nshipster.com/mklocalsearch/

Apple Maps had a rough launch in iOS 6, but many missed a useful new feature added in iOS 6.1: MKLocalSearch.

MKLocalSearch lets your app search for places (restaurants, shops, etc.) using normal language, all powered by Apple’s own data.

How it works:

It returns a list of MKMapItem objects with name, address, phone number, website, and coordinates.

Key advantages:

Because Apple does not charge for it and imposes no quotas, MKLocalSearch is often the simplest and cheapest way to add place search to an iOS app – even if you use another map for display. It remains a hidden gem of MapKit.


Category:

Year: