1. 程式人生 > >iOS 百度地圖反編碼

iOS 百度地圖反編碼

_geoSearch = [[BMKGeoCodeSearch alloc]init] ;
    _geoSearch.delegate = self;

[self reverseGeoSearch:CLLocationCoordinate2DMake(lat, login)];

- (void)reverseGeoSearch:(CLLocationCoordinate2D)pt{
    
    BMKReverseGeoCodeOption *reverseGeocodeSearchOption = [[BMKReverseGeoCodeOption alloc]init];
    reverseGeocodeSearchOption.reverseGeoPoint = pt;
    BOOL flag = [_geoSearch reverseGeoCode:reverseGeocodeSearchOption];
    if(flag)
    {
        NSLog(@"反geo檢索傳送成功");
    }
    else
    {
        NSLog(@"反geo檢索傳送失敗");
    }
}

-(void)onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error{
    if (error == BMK_SEARCH_NO_ERROR) {
        BBLog(@"反編碼地址-----%@",result.address);
    }
}