this is my first post on stack. I am new to iOS development, and need help with geocoding.
In particular, according to Apple's documentation: "The number of returned placemark objects depends greatly on the specificity of the information provided. Thus, providing street, city, province, and country information is much more likely to return a single address than just street and city information."
So being broad when providing the address string, should (in theory) return multiple results.
Example:
-(void)geocodeAddress {
CLGeocoder *geocoder = [[CLGeocoder alloc]init];
[geocoder geocodeAddressString:@"DMV, San Francisco, CA" completionHandler:^(NSArray *placemarks, NSError *error) {
if (!error) {
NSLog(@"Found: %i", [placemarks count]);
for (CLPlacemark *placemark in placemarks) {
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(placemark.location.coordinate.latitude, placemark.location.coordinate.longitude);
MapAnnotation *annotation = [MapAnnotation mapAnnotationWithCoordinate:coordinate title:@"DMV" subtitle:@"Great service?"];
[self.mapView addAnnotation:annotation];
}
} else {
NSLog(@"Error code: %i", [error code]);
}
}];
}
Whats a bit confusing to me, is that regardless of how broad my "search" is (Starbucks, DMV, vs. 1234 S 312th Place, City, State), I ALWAYS get one location returned.
So, my question is, is there a way to return multiple results for s specific search?