iOS:如何从地标获取邮​​政编码

时间:2014-01-13 23:34:23

标签: ios objective-c mkmapview mkplacemark

我想知道如何在iOS中获取地标的邮政编码。任何提示或建议将深表感谢。这是我到目前为止的代码,我能够得到这个城市。

 - (void)recenterMapToPlacemark:(CLPlacemark *)placemark {
MKCoordinateRegion region;
MKCoordinateSpan span;

span.latitudeDelta = 0.02;
span.longitudeDelta = 0.02;

region.span = span;
region.center = placemark.location.coordinate;

NSString *city = [placemark locality];

 }

1 个答案:

答案 0 :(得分:2)

查看此处的文档: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLPlacemark_class/Reference/Reference.html#//apple_ref/occ/instp/CLPlacemark/postalCode

这是您正在寻找的postalCode财产 所以在你的情况下它是:

NSString *zipCode = placemark.postalCode;