I try to get the ISO Country Code locale like "en_US" from a CLPlacemark Object. When i do a NSLog on the object, I get a lot of text including this:
address = {
"localized_address" = (
{
address = {
formattedAddressLine = (
"Piccadilly Circus",
"Coventry Street",
London,
W1J,
England
);
structuredAddress = {
administrativeArea = England;
areaOfInterest = (
"Piccadilly Circus",
"Great Britain"
);
country = "United Kingdom";
countryCode = GB;
dependentLocality = (
Mayfair
);
fullThoroughfare = "Coventry Street";
geoId = (
);
locality = London;
postCode = W1J;
subAdministrativeArea = London;
subLocality = Mayfair;
thoroughfare = "Coventry Street";
};
};
locale = "en_US";
You can see in the last line exactly the information i need. But i've no clue how to access this information directly.
When I try to access the ISOcountryCode property of CLPlacemark i only get GB.
Thanks for your help Bernhard
It's a bit hackish, but this is one way that you may be able to obtain the information
That regex is ugly and can probably be improved (I used http://txt2re.com), but this should be able to get the locale for you.