Local Search (iOS)

This article describes how to show points of interest near the user's location using the iOS SDK.

You can use the MRLocalSearch, MRLocalSearchRequest, MRLocalSearchResponse, MRLocalSearchResult classes to find points of interest near the user's location. Combine these classes with MRLocationManager to provide a location and its nearby placemarks.

For best performance, limit local search results to 20 or less.

    - (void)findNearbyCafe {
        MRLocalSearchRequest *request = [MRLocalSearchRequest new];
        request.app = self.appKey;
        request.location = self.locationManager.location;
        request.transportType = MRDirectionsTransportTypeWalking;
        request.naturalLanguageQuery = @"Cafe";
        request.limit = 20;

        MRLocalSearch *search = [[MRLocalSearch alloc] initWithRequest:request];
        [search startWithCompletionHandler:^(MRLocalSearchResponse *response, NSError *error) {

            if (response) {
                for (MRLocalSearchResult *result in response.results)
                    NSLog(@"%@ is %f seconds away", result.placemark.name, result.expectedTravelTime);

            } else if (error) {
                NSLog(@"Error loading search results: %@", error.localizedDescription);