cfischer cfischer - 1 year ago 51
Objective-C Question

How to retrieve the address from a location returned by Core Location

Is there a way to turn a longitude/latitude location (as returned by Core Location) into an address (street and city)?

Answer Source

The best way is using reverse geocoding, which is available in CLGeocoder class. To get human readable address from geoposition, you have to use reverseGeocodeLocation method.

Here is small sample:

-(NSString *)getAddressFromLocation:(CLLocation *)location {
    NSString *address;
    CLGeocoder *geocoder = [[CLGeocoder alloc] init];
    [geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error)
         if(placemarks && placemarks.count > 0)
             CLPlacemark *placemark= [placemarks objectAtIndex:0];

             address = [NSString stringWithFormat:@"%@ %@,%@ %@", [placemark subThoroughfare],[placemark thoroughfare],[placemark locality], [placemark administrativeArea]];



    [geocoder release];
    return address;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download