Iphone 为什么地址字典上没有邮政编码?
我正在开发基于地理编码器的应用程序。在我的应用程序中,为了获得用户的当前地址,我在geocode委托方法中使用placemark地址字典方法,然后,我可以获得除postalcode之外的所有详细信息(街道、城市、州、县、国家代码和所有)。为什么邮政编码不来?。现在我正在使用iOS 4。请帮帮我 我的代码Iphone 为什么地址字典上没有邮政编码?,iphone,objective-c,map,mkmapview,Iphone,Objective C,Map,Mkmapview,我正在开发基于地理编码器的应用程序。在我的应用程序中,为了获得用户的当前地址,我在geocode委托方法中使用placemark地址字典方法,然后,我可以获得除postalcode之外的所有详细信息(街道、城市、州、县、国家代码和所有)。为什么邮政编码不来?。现在我正在使用iOS 4。请帮帮我 我的代码 - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemar
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
placemark = [[MKPlacemark alloc] initWithCoordinate:locationManager.location.coordinate addressDictionary:[placemark addressDictionary]];
NSLog(@"Address Dictionary %@", [placemark addressDictionary]);
NSDictionary * addressDict= [placemark addressDictionary];
country = [addressDict objectForKey:@"Country"];
postal = [addressDict objectForKey:@"PostalCode"];
state = [addressDict objectForKey:@"State"];
city = [addressDict objectForKey:@"City"];
}
这是我的当前地址,来自placemark地址字典
Address Dictionary {
City = Madurai;
Country = India;
CountryCode = IN;
FormattedAddressLines = (
"Lady Doak College Rd, Chinna Chokkikulam, Chockikulam",
"Madurai, Tamil Nadu",
India
);
State = "Tamil Nadu";
Street = "Lady Doak College Rd";
SubAdministrativeArea = Madurai;
SubLocality = "Chinna Chokkikulam";
Thoroughfare = "Lady Doak College Rd";
}
在上面的代码中,没有poastalCode。但我需要邮政编码。要获得邮政编码,我想做什么?请给出解决方案。您可以使用免费的倒车档 地理编码服务为您提供此服务 谷歌有这样的服务: 或者,这篇谷歌群组帖子 有其他反面的清单 地理编码服务:
我已通过删除下面的行解决了问题,无需初始化placemark
placemark = [[MKPlacemark alloc] initWithCoordinate:locationManager.location.coordinate addressDictionary:[placemark addressDictionary]];