iOS 百度地图反编码地理位置信息
来源:互联网 发布:域名被墙 301跳转 编辑:程序博客网 时间:2024/04/30 10:35
1:创建
_locService = [[BMKLocationService alloc]init];
_geocodesearch = [[BMKGeoCodeSearch alloc]init];_geocodesearch.delegate = self;
_locService.delegate = self;
2:开始定位
_locService.desiredAccuracy = kCLLocationAccuracyBest;//设置定位精度
[_locService startUserLocationService];
3:实现delegate
#pragma mark -定位成功
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation{
NSLog(@"didUpdateUserLocation lat %f,long %f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude);
NSString *lat = [NSString stringWithFormat:@"%f",userLocation.location.coordinate.latitude];
NSString *lon = [NSString stringWithFormat:@"%f",userLocation.location.coordinate.longitude];
UZGPersonalSetting *s=[UZGPersonalSetting getInstance];
s.currLocationl=[NSString stringWithFormat:@"%f,%f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude];
CLLocationCoordinate2D pt = (CLLocationCoordinate2D){0, 0};
if (lat!=nil && lon!=nil) {
pt = (CLLocationCoordinate2D){[lat floatValue], [lon floatValue]};
}
BMKReverseGeoCodeOption *reverseGeocodeSearchOption = [[BMKReverseGeoCodeOption alloc]init];
reverseGeocodeSearchOption.reverseGeoPoint = pt;
BOOL flag = [_geocodesearch reverseGeoCode:reverseGeocodeSearchOption];
if(flag) NSLog(@"反geo检索发送成功");
}
#pragma mark -定位失败
- (void)didFailToLocateUserWithError:(NSError *)error{
if (error.code == 1) {
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"定位服务未开启" message:@"请进入系统设置内开启定位服务(设置-->隐私-->定位服务-->XXX)" delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:@"设置", nil];
[[alert rac_buttonClickedSignal] subscribeNext:^(NSNumber *indexNumber) {
if ([indexNumber intValue] == 1) {
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];
}
}];
[alert show];
}else{
[MBProgressHUD showError:@"定位失败,请稍后再试"];
}
}
4:实现反编码的delegate
-(void) onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error {
UZGPersonalSetting *s = [UZGPersonalSetting getInstance];
s.locateAddress = result.address;
_locateShop = [[ViewControllerHttpLocateShop alloc]init];
_locateShop.delegate=self;
[_locateShop initHttpLocateShop];
}
- iOS 百度地图反编码地理位置信息
- iOS 百度地图反编码
- 百度地图之地理位置和反地理编码搜索
- ios百度地图定位反地理编码
- iOS百度地图反编码个人见解
- 百度地图反编码地址及ios地图使用
- 百度地图开发之定位以及反地理编码获取周围地理位置
- iOS获取经纬度 地理位置编码反编码
- ios 定位经纬度获取位置信息,地理位置编码与反编码
- iOS 百度地图定位与反地理编码
- IOS 百度地图定位,显示地理位置
- iOS之百度地图获取地理位置名称
- IOS 百度地图定位,显示地理位置
- iOS 百度地图 判断应用是否授权、地理位置的正反编码
- 百度地图定位编码反编码
- iOS百度地图简单应用( iOS地图定位(定位、地理编码与反地理编码、mapView、大头针)
- 百度地图SDK反地理编码错误
- 定位、地理位置编码、地理位置反编码
- 数据结构—栈
- php开发日记之生成图片
- 数据分析——数据标准化
- error C4430: 缺少类型说明符 - 假定为 int
- 堆排序(C#)
- iOS 百度地图反编码地理位置信息
- SQLServer 里面的 DDL,DML,DCL,TCL
- freemarker循环遍历Map
- 汕头正宗的牛肉丸多少钱一斤的
- LeetCode---Spiral Matrix II
- Codeforces Round #327 (Div. 1) B题: Chip 'n Dale Rescue Rangers [数学题]
- 库函数strcpy/strlen的工作方式
- 几道笔试题
- android中的常用线程池区别--转载