gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:08:24 25 4
gpt4 key购买 nike

我想知道如何在 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];

}

最佳答案

在此处查看文档: 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;

关于iOS:如何从地标获取邮​​政编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21103483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com