CLLocation *c = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
//创建位置
CLGeocoder *revGeo = [[CLGeocoder alloc] init];
//反向地理编码
[revGeo reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
if (!error && [placemarks count] > 0)
{
NSDictionary *dict = [[placemarks objectAtIndex:0] addressDictionary];
NSLog(@"street address: %@",[dict objectForKey:@"Street"]);
}
else
{
NSLog(@"ERROR: %@", error);
}
}];
网友评论