相关疑难解决方法(0)

在iOS中获取纬度和经度的位置名称

我想从纬度和经度中找到当前位置名称,

这里是我的代码片段我试过,但我的日志显示,除了在所有的地方空值placemark,placemark.ISOcountryCodeplacemark.country

我想要的价值placemark.locality,并placemark.subLocality却是露出空值.

- (void)viewWillAppear:(BOOL)animated
{
     [super viewWillAppear:animated];

    // this creates the CCLocationManager that will find your current location
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
    [locationManager startUpdatingLocation];

}

// this delegate is called when the app successfully finds your current location
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    CLGeocoder *geocoder = [[CLGeocoder alloc] init];
    [geocoder reverseGeocodeLocation:locationManager.location
                   completionHandler:^(NSArray *placemarks, NSError *error) {
                       NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!"); …
Run Code Online (Sandbox Code Playgroud)

iphone reverse-geocoding cllocationmanager ipad ios

16
推荐指数
3
解决办法
4万
查看次数

标签 统计

cllocationmanager ×1

ios ×1

ipad ×1

iphone ×1

reverse-geocoding ×1