tags:

views:

24

answers:

1

Hi, I noticed that MKReverseGeocoder returns the country / city / etc. names in the locale of the iPhone's currentLocale. Is there a way to set the currentLocale, or to set the NSLocale instance that a reverseGeocoder is using?

A: 

Yes there is, I had the same problem and used this code to great effect: ("en" is for english for example.)

[[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];

You may or may not synchronize at some point or straight after:

[[NSUserDefaults standardUserDefaults] synchronize]; 

Now there are a couple of notes on this:

  • This will work if for example you are in London and have set your iPhone in another language, it will always return geo names in English.

  • What I haven't tested yet but I've seen some odd behaviour is that if have set english as you language but you are abroad (IE Denmark, I was once on a trip to DK) and noticed the revgeocoding was in danish, but this was before I've used that magic line of code. Still with my iPhone in english in Denmark I was expecting english results but no cigar at that time.

Dado