0
我目前正在使用將使用reversegeocode返回的數據的應用程序。現在,我可以成功接收以下位置值:地址,城市,州,郵政編碼和國家/地區。除了我能夠獲得的值之外,我還想獲取我反向地理位置的鄰域名稱。我的代碼如下:當我反向地理代碼時,CLGeocoder不返回鄰域名稱
CLLocationManager *location = [[CLLocation alloc] init];
[location setDelegate:self];
location.desiredAccuracy=kCLLocationAccuracyBest;
location.distanceFilter=kCLDistanceFilterNone;
[location startMonitoringSignificantLocationChanges];
CLGeocoder *geolocation = [[CLGeocoder alloc] init];
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"Update method is definitely being called!");
NSLog(@"Your current location is : %@", [locations lastObject]);
[geolocation reverseGeocodeLocation:[locations lastObject] completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"Reverse geocode complete: %@", placemarks);
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"The locality area is: %@", placemark.locality);
}];
}
我預計placemark.locality返回鄰居,但它返回城市,而不是。
任何幫助將不勝感激,
戴夫