I am using reverseGeocodeLocation
to fetch the zip code and it works fine; however, it only has 5 digits of zip code. How to get the full ZIP code? Here is 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"];
}
}];
}