// 创建经纬度
CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
//创建一个译码器
CLGeocoder *cLGeocoder = [[CLGeocoder alloc] init];
[cLGeocoder reverseGeocodeLocation:userLocation completionHandler:^(NSArray *placemarks, NSError *error) {
CLPlacemark *place = [placemarks objectAtIndex:0];
// 位置名
NSLog(@"name,%@",place.name);
// 街道
NSLog(@"thoroughfare,%@",place.thoroughfare);
// 子街道
NSLog(@"subThoroughfare,%@",place.subThoroughfare);
// 市
NSLog(@"locality,%@",place.locality);
// 区
NSLog(@"subLocality,%@",place.subLocality);
// 国家
NSLog(@"country,%@",place.country);
}
}];
/* CLPlacemark中属性含义
name 地名
thoroughfare 街道
subThoroughfare 街道相关信息,例如门牌等
locality 城市
subLocality 城市相关信息,例如标志性建筑
administrativeArea 直辖市
subAdministrativeArea 其他行政区域信息(自治区等)
postalCode 邮编
ISOcountryCode 国家编码
country 国家
inlandWater 水源,湖泊
ocean 海洋
areasOfInterest 关联的或利益相关的地标
*/