CLGeocoder从给定的位置反向地理编码

给定经度和纬度不是我目前的位置我怎样才能使用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]; }]; 

显然只会对我的位置进行地理编码,但是我需要明确地设置经度和纬度。

我从来没有尝试过,但不能创build自己的CLLocation对象?

如果你知道当前的经度和纬度,你可以 –

 CLLocation *location = [[CLLocation alloc]initWithLatitude:someValue longitude:someValue]; [self.geoCoder reverseGeocodeLocation: location completionHandler: ^(NSArray *placemarks, NSError *error) { //do something });