iphone - 为什么地址词典中没有邮政编码?

标签 iphone objective-c dictionary mkmapview

我正在开发基于地理编码器的应用程序。在我的应用程序中,为了获取用户当前地址,我在地理编码委托(delegate)方法中使用地标地址字典方法,然后,我可以获得除邮政编码之外的所有详细信息(街道、城市、州、县、国家/地区代码等)。为什么邮政编码不来?现在我正在使用 iOS 4。请帮助我。

我的代码,

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark    *)placemark
 {  
      placemark = [[MKPlacemark alloc] initWithCoordinate:locationManager.location.coordinate addressDictionary:[placemark addressDictionary]];

      NSLog(@"Address Dictionary %@", [placemark addressDictionary]);

      NSDictionary * addressDict= [placemark addressDictionary];

      country = [addressDict objectForKey:@"Country"];

      postal = [addressDict objectForKey:@"PostalCode"];

      state = [addressDict objectForKey:@"State"];

      city = [addressDict objectForKey:@"City"];

 }

这是我当前的地址,来自地标地址字典。

Address Dictionary {
City = Madurai;
Country = India;
CountryCode = IN;
FormattedAddressLines =     (
    "Lady Doak College Rd, Chinna Chokkikulam, Chockikulam",
    "Madurai, Tamil Nadu",
    India
);
State = "Tamil Nadu";
Street = "Lady Doak College Rd";
SubAdministrativeArea = Madurai;
SubLocality = "Chinna Chokkikulam";
Thoroughfare = "Lady Doak College Rd";
}

在上面的代码中,没有 poastalCode。但我需要邮政编码。要获取邮政编码,我想做什么?请给出解决方案。

最佳答案

您也许可以使用免费的反向 地理编码服务可以为您完成此操作。

Google 有这样的服务: http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding

或者,这个 Google 网上论坛帖子 有其他反向列表 地理编码服务: http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders?pli=1

关于iphone - 为什么地址词典中没有邮政编码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3626354/

相关文章:

iphone - 在 iOS 设备上本地保存游戏分数...需要安全吗?

iOS:如何以最简单的方式测试互联网连接,而不卡住应用程序(没有可达性)?

ios - 查找与特定字符串的匹配项

dataframe - 将 CSV 文件读取到字典中

java - 为什么我会收到此错误? (UIManager无法应用)

python - 按频率组织字典

iphone - 将 NSFetchedResultsController 的结果转换为 NSArray

iphone - 我在哪里可以找到iphone项目中的资源文件(css,js ..)

ios - 如何为 iOS 创建游戏 map ?

ios - 无法在选项卡栏中设置BadgeValue Objective C