给定经度和纬度而不是我当前的位置,我如何使用 执行反向地理编码查找GLGeocoder
?
self.geoCoder = [[CLGeocoder alloc] init];
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
// [self.locationManager startUpdatingLocation];
[self.geoCoder reverseGeocodeLocation: locationManager.location completionHandler: ^(NSArray *placemarks, NSError *error) {
// [self.locationManager stopUpdatingLocation];
CLPlacemark *placemark = [placemarks objectAtIndex:0];
// Long address
// NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
// Short address
NSString *locatedAt = [placemark subLocality];
cell.textLabel.text = spot.name;
cell.detailTextLabel.text = [NSString stringWithFormat:@"Cab no: %@, spotted at %@", spot.cabno, locatedAt];
}];
显然只会对我的位置进行地理编码,但我需要明确设置要反转的经度和纬度。