反向地理定位:邮政编码问题

时间:2012-12-20 22:45:46

标签: objective-c ios geolocation reverse-geocoding

此代码用于使用Reverse Geolocation获取用户的整个地址。有人可以建议我从中获取邮政编码或邮政编码。

//Geocoding Block
[self.geoCoder reverseGeocodeLocation: locationManager.location completionHandler:
 ^(NSArray *placemarks, NSError *error) {

     //Get nearby address
     CLPlacemark *placemark = [placemarks objectAtIndex:0];


     //String to hold address
     NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];


     //Print the location to console
     NSLog(@"I am currently at %@",locatedAt);

     //Set the label text to current location
     [locationLabel setText:locatedAt];

 }];

1 个答案:

答案 0 :(得分:0)

使用Google地图将地理位置转换为zip地址。

https://developers.google.com/maps/documentation/geocoding/