// 創建經緯度
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 關聯的或利益相關的地標
*/