Skip to content

Instantly share code, notes, and snippets.

@anoadragon453
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anoadragon453/be710fda30053117107e to your computer and use it in GitHub Desktop.
Save anoadragon453/be710fda30053117107e to your computer and use it in GitHub Desktop.
CLGeocoder *geocoder = [CLGeocoder new];
[geocoder geocodeAddressString:@"ADDRESS_TO_SEARCH" completionHandler:^(NSArray *placemarks, NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
return; // Request failed, log error
}
// A location was generated, hooray!
if (placemarks && [placemarks count] > 0) {
CLPlacemark *placemark = placemarks[0]; // Our placemark
// Do something with the generated placemark
NSLog(@"Lat: %f, Long: %f", placemark.location.coordinate.latitude, placemark.location.coordinate.longitude);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment