After autocomplete, we do a place look up, then pass the coordinates to GMSGeocoder to retrieve the details, but I am still missing street_name and street_number.
CLLocationCoordinate2D addressCoordinates = CLLocationCoordinate2DMake(latitude,longitude);
GMSGeocoder* coder = [[GMSGeocoder alloc] init];
[coder reverseGeocodeCoordinate:addressCoordinates completionHandler:^(GMSReverseGeocodeResponse *results, NSError *error) {
if (error) {
NSLog(@"Error %@", error.description);
} else {
GMSAddress* address = [results firstResult];
NSLog(@"thoroughfare %@",address.thoroughfare);
NSLog(@"locality %@",address.locality);
NSLog(@"subLocality %@",address.subLocality);
NSLog(@"administrativeArea %@",address.administrativeArea);
NSLog(@"postalCode %@",address.postalCode);
NSLog(@"country %@",address.country);
NSLog(@"lines %@",address.lines);
}
}];
I'm thinking of switching to iOS's own reverse geocoder.
[CLGeocoder reverseGeocodeLocation:[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] completionHandler:
^(NSArray* placemarks, NSError* error) {