// 創(chuàng)建經(jīng)緯度
CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
//創(chuàng)建一個(gè)譯碼器
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);
// 區(qū)
NSLog(@"subLocality,%@",place.subLocality);
// 國(guó)家
NSLog(@"country,%@",place.country);
}
}];
/* CLPlacemark中屬性含義
name 地名
thoroughfare 街道
subThoroughfare 街道相關(guān)信息,例如門牌等
locality 城市
subLocality 城市相關(guān)信息,例如標(biāo)志性建筑
administrativeArea 直轄市
subAdministrativeArea 其他行政區(qū)域信息(自治區(qū)等)
postalCode 郵編
ISOcountryCode 國(guó)家編碼
country 國(guó)家
inlandWater 水源足画,湖泊
ocean 海洋
areasOfInterest 關(guān)聯(lián)的或利益相關(guān)的地標(biāo)
*/