A utility object for generating a list of completion strings based on a partial search string that you provide.


@interface MKLocalSearchCompleter : NSObject


You use an MKLocalSearchCompleter object to retrieve auto-complete suggestions for your own map-based search controls. As the user types text, you feed the current text string into the search completer object, which delivers possible string completions that match locations or points of interest.

You create and configure MKLocalSearchCompleter objects yourself. You must always assign a delegate object to the search completer so that you can receive the search results that it generates. You should also specify a search region to restrict results to a designated area.Listing 1 shows a simple example of a view controller that stores the MKLocalSearchCompleter object in a property. The view controller itself acts as the delegate for the completer and the view controller uses the region associated with an MKMapView object that is part of the view controller’s interface. Completer objects are long-lived objects, so you can store strong references to them and reuse them later in your code.

Listing 1

Creating and configuring a search completer

- (void)viewDidLoad {
   [super viewDidLoad];
   self.completer = [[MKLocalSearchCompleter alloc] init];
   self.completer.delegate = self;
   // Limit search results to the map view's current region.
   self.completer.region = self.myMapView.region;

Update the value of the completer’s queryFragment property to begin a search query. You can update this property in real time as the user types new characters into a text field because the completer object waits a short amount of time for the query string to stabilize. When modifications to the query strong stop, the completer initiates a new search and returns the results to your delegate as an array of MKLocalSearchCompletion objects.


Receiving the Search Results


The object that receives the completion results.


Defines the methods for receiving search completion data.

Specifying the Query Attributes


The search string for which you want completions.


The region that defines the geographic scope of the search.


The filter options for the search results.

Cancelling the Query

- cancel

Cancels an in-progress search operation.


A Boolean value indicating whether a search operation is in progress.

Getting the Current Query Results


The most recently received search completions.



Constants indicating the types of search completions to return.


Inherits From

See Also

Placemark Search

Searching for Nearby Points of Interest

Provide automatic search completions based on a user’s partial search query, and search the map for relevant locations nearby.


A utility object for initiating map-based searches and processing the results.


A fully formed string that completes a partial string.