//反向地理编码
CLGeocoder *clGeoCoder = [[CLGeocoder alloc] init];
CLLocation *cl = [[CLLocation alloc] initWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude];
[clGeoCoder reverseGeocodeLocation:cl completionHandler: ^(NSArray *placemarks,NSError *error) {
for (CLPlacemark *placeMark in placemarks) {
NSDictionary *addressDic = placeMark.addressDictionary;
NSString *state=[addressDic objectForKey:@"State"];
NSString *city=[addressDic objectForKey:@"City"];
NSString *subLocality=[addressDic objectForKey:@"SubLocality"];
NSString *street=[addressDic objectForKey:@"Street"];
NSLog(@"所在城市====%@ %@ %@ %@", state, city, subLocality, street);
[_locationManager stopUpdatingLocation];
}
}];
---------------------
作者:霜在飞
来源:CSDN
原文:https://blog.csdn.net/xsh841272293/article/details/52808461
版权声明:本文为博主原创文章,转载请附上博文链接!