Вопрос

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