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, MRPlacemarkResponse, MRPlacemarkResult 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];
    [self.search startWithCompletionHandler:^(MRPlacemarkResponse *response, NSError *error) {
        if (response) {
            for (MRPlacemarkResult *result in response.results)
                NSLog(@"%@ is %f seconds away",
                    result.placemark.name, result.expectedTravelTime);

        } else if (error) {
            NSLog(@"Error loading search results: %@", error.localizedDescription);
        }
    }];
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.