Question

I am developing an application based on geocoder. I am using the placemark address dictionary method inside the geocoder delegate method. I'm able to get all the details (street, city, state, county, countrycode and all) except postalcode for India. Why is postal code missing? Any suggestions are appreciated

My code:

-(void)locationUpdate:(CLLocation *)location

{

currentLocation= [location coordinate];

if (currentLocation.latitude!=checking.latitude) 
{
    NSDate *currentTime =[NSDate date];

    fireTime = currentTime;

    checking.latitude=currentLocation.latitude;  
    checking.longitude=currentLocation.longitude;

}
MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:[location coordinate]];
[geocoder setDelegate:self];
[geocoder start];
}


-(void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark

{
    NSLog(@"placemark.postalCode ***********%@",placemark.postalCode);
}

I am getting this output as the geocoder has returned:

{

City = Vishakhapatnam;
Country = India;
CountryCode = IN;
FormattedAddressLines =     (
    NH5,
    Vishakhapatnam,
    "Andhra Pradesh",
    India
);
State = "Andhra Pradesh";
Street = NH5;
Thoroughfare = NH5;

}



placemark.postalCode *********** (null)

Its works fine for other countries but I'm not getting Zip code for India locations. How can I get postal code for India locations also?

Was it helpful?

Solution

It is because MapKit is using Apple maps to retrive data. Apple maps in India is not that good when coming to retrive Indian Addresses.

Try using google api if you want to get expected results.

Google has released maps SDK for iOS, here is the link for it. https://developers.google.com/maps/documentation/ios

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top