//首先你要有经纬度api手机版,这个自己定位出来或者从服务器获取固定的都行,然后加BMKSearchDelegate
#import "BMKGeocodeTypeapi手机版。h" //加上这个头文件,地理编码和反地理编码要用上
BMKSearch *search = [[BMKSearch alloc]init];
searchapi手机版。
delegate = self;
CLLocationCoordinate2D pt = (CLLocationCoordinate2D){0,0};
pt=(CLLocationCoordinate2D){coordinatex,coordinatey};
NSLog(@"搜索成功?:%d",[search reverseGeocode:pt]);
//上面代码会执行下面的事件
- (void)onGetAddrResult:(BMKAddrInfo*)result errorCode:(int)error{
//具体位置
if (error == 0) {
if (resultapi手机版。
addressComponentapi手机版。streetName!=nil&&result。addressComponent。streetNumber!=nil) {
//具体位置
address = [NSString stringWithFormat:@"当前位置:%@%@",resultapi手机版。
addressComponentapi手机版。streetName,result。addressComponent。streetNumber];
}else{
//具体位置
address = [NSString stringWithFormat:@"当前位置:%@",resultapi手机版。
strAddr];
}api手机版。