CLGeocoder反解析用户的地址

来源:互联网 发布:淘宝每日一抢 编辑:程序博客网 时间:2024/06/16 05:32

UIlael lab_Area;-(void)getUserCurrentAddress{        CLGeocoder *geoCoder=[[CLGeocoder alloc]init];    AppDelegate *delegate=(AppDelegate *)[UIApplication sharedApplication].delegate;    CLLocation *mycurLocaton=[[CLLocation alloc]initWithLatitude:delegate.currentCoordinate.latitude    longitude:delegate.currentCoordinate.longitude];    //反解析    [geoCoder reverseGeocodeLocation:mycurLocaton completionHandler:^(NSArray *places,NSError *error){        CLPlacemark *aPlace=[places objectAtIndex:0];        if (aPlace.name==nil) {            [lab_Area setText:@"无法获取信息"];        }else        {            [lab_Area setText:aPlace.name];        }        [geoCoder release];        [mycurLocaton release];    }];}


原创粉丝点击