开发者

Change the Locale of MKReverseGeocoder's response?

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜