Created
July 29, 2013 23:38
-
-
Save UjwalManjunath/6108872 to your computer and use it in GitHub Desktop.
Converting Longitude Lattitude to Street Address (IOS/ OBJECTIVE C)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)locationManager:(CLLocationManager *)manager | |
didUpdateLocations:(NSArray *)locations{ | |
CLLocation *currentLocation = [locations lastObject]; | |
if (currentLocation != nil) { | |
NSLog(@" Longitude: %@",[NSString stringWithFormat:@"%.8f", currentLocation.coordinate.longitude]); | |
NSLog(@"Latitude: %@",[NSString stringWithFormat:@"%.8f", currentLocation.coordinate.latitude]); | |
} | |
[self.locationManager stopUpdatingLocation]; | |
NSLog(@"Resolving the Address"); | |
self.geocoder = [[CLGeocoder alloc]init]; | |
[self.geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) { | |
if(error == nil && [placemarks count]>0){ | |
self.placemark = [placemarks lastObject]; | |
NSLog(@"Address : %@ %@ \n %@ %@ \n %@ \n %@",self.placemark.subThoroughfare,self.placemark.thoroughfare,self.placemark.postalCode,self.placemark.locality | |
,self.placemark.administrativeArea,self.placemark.country); | |
} | |
else { | |
NSLog(@"%@", error.debugDescription); | |
} | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment