geocodeAddress

Hello,


I'm having a bug with the convertion of an NSString (which contains a place from a textfiel input) to a CLLocation.


Here is the method supposed to process the convertion:


- (void)geoCodeForAddress:(NSString *)address {

CLGeocoder *geocoder = [[CLGeocoder alloc] init];

[geocoder geocodeAddressString:address completionHandler:^(NSArray* placemarks, NSError* error){

dispatch_async(dispatch_get_main_queue(), ^{

CLPlacemark *placeMark = [placemarks lastObject];

if (placeMark.location != nil) {

self.actionLocation = placeMark.location;

} else {

self.actionLocation = nil;

}

if(self.event)

[self.tableView reloadData];

});

}];

}


My problem is, this method returns the wrong location for some specific strings. For instance, whenever I try to use "la patache paris" as an input, it returns a location in the wrong city though when I try the same exact string in Maps, it's finding the right place.


The method "geocodeAddressString: completionHandler:" is a "CoreLocation" methods from the "CLGeocoder" class so there is no way I can see what's going on in it.


Would someone have some lead to find out why this is behaving weirdly ?


Thank you.

geocodeAddress
 
 
Q