一行代码获取用户地理位置和逆地理编码后的地址
查看次数:4132
下载次数:701
上传时间:2016-08-24
大小:264 B
github地址: https://github.com/qxuewei/XWLocationManager
觉得有帮助感激多多star ☺️☺️☺️
使用方法: 1.在iOS8.0之后定位, 必须在info.plist, 配置NSLocationWhenInUseUsageDescription 或者 NSLocationAlwaysUsageDescription 2.在需要获取用户位置的地方
[[XWLocationManager sharedXWLocationManager] getCurrentLocation:^(CLLocation *location, CLPlacemark *placeMark, NSString *error) {
if (error) {
NSLog(@"定位出错,错误信息:%@",error);
}else{
NSLog(@"定位成功:经度:%f 纬度:%lf 当前地址:%@
location详细信息:%@
",location.coordinate.latitude, location.coordinate.longitude, placeMark.name, location);
[self.userLocationInfo setText:[NSString stringWithFormat:@"定位成功:经度:%f 纬度:%lf 当前地址:%@
location详细信息:%@
",location.coordinate.latitude, location.coordinate.longitude, placeMark.name, location]];
}
} onViewController:self];
即可获取用户当前位置的经纬度和当前所在地址.
收藏