문제

I've been googling around a little bit, but i can't seem to find code snippets that can give me the zip code of the current location from an iOS device without any use of API's and such. Most answers regarding the topic are using deprecated classes. And if this is possible, will it only get zip codes from the US or other countries in Europe aswell?

Any help would be greatly appreciated. :)

도움이 되었습니까?

해결책

Since MKReverseGeocoder is deprecated in iOS 5, now it's CLGeocoder. You could create a CLGeocoder object and, with a previously-created CLLocation object with the coordinates, use the following method:

- (void)reverseGeocodeLocation:(CLLocation *)location completionHandler:(CLGeocodeCompletionHandler)completionHandler

Here is an example and Document.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top