}else // 编码成功,找到了具体的位置信息
{
//打印查看找到的所有的位置信息
/*
name:名称
locality:城市
country:国家
postalCode:邮政编码
*/
for (CLPlacemark *placemark in placemarks) {
NSLog(@"name=%@ locality=%@ country=%@ postalCode=%@",placemark.name,placemark.locality,placemark.country,placemark.postalCode);
}
//取出获取的地理信息数组中的第一个显示在界面上
CLPlacemark *firstPlacemark=[placemarks firstObject];
//详细地址名称
self.detailAddressLabel.text=firstPlacemark.name;
//纬度
CLLocationDegrees latitude=firstPlacemark.location.coordinate.latitude;
//经度
CLLocationDegrees longitude=firstPlacemark.location.coordinate.longitude;
self.latitudeLabel.text=[NSString stringWithFormat:@"%.2f",latitude];
self.longitudeLabel.text=[NSString stringWithFormat:@"%.2f",longitude];
}
}];
}
/**
* 反地理编码:经纬度坐标—>地名










