8
I’m using the reverseGeocodeLocation
to search for the zip code and it works well; however, it only brings 5 digits of the zip code. How to get the full zip code? Follow the code:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
CLLocationCoordinate2D coords = newLocation.coordinate;
lastLat = coords.latitude;
lastLng = coords.longitude;
CLGeocoder *reverse = [[CLGeocoder alloc] init];
CLLocation *location = [[CLLocation alloc] initWithLatitude:coords.latitude longitude:coords.longitude];
lastAccuracy = newLocation.horizontalAccuracy;
lblAccuracy.text = [NSString stringWithFormat:@"%f",lastAccuracy];
if(lastAccuracy<=10)
{
[reverse reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
if ([placemarks count]>0) {
CLPlacemark *place = [placemarks objectAtIndex:0];
strCEP = place.postalCode;
strLastSubLocation = place.subLocality;
strLastLocation = place.locality;
strEndereco = place.thoroughfare;
lblEndereco.text = strEndereco;
strLastLocation = [strLastLocation stringByReplacingOccurrencesOfString:@"Saõ" withString:@"São"];
}
}];
}
Hello Friend! Perfect! It worked! Thank you very much for your help, I will follow your guidelines.
– Silvio Vaz