我只是好奇.也许是为了未来的项目.我想知道是否可以通过Google API从给定坐标中检索地址.
我想从纬度和经度中找到当前位置名称,
这里是我的代码片段我试过,但我的日志显示,除了在所有的地方空值placemark,placemark.ISOcountryCode和placemark.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)