开发者

When doing a reverse geocoding request Google magically recognizes my iPhone language

开发者 https://www.devze.com 2023-03-26 09:18 出处:网络
Im sending a simple url request using the following url: urlString = [NSString stringWithFormat: @\"http://maps.googleapis.com/maps/api/geocode/xml?latlng=%f,%f&sensor=true\", lat, lng];

Im sending a simple url request using the following url:

urlString = [NSString stringWithFormat: 
             @"http://maps.googleapis.com/maps/api/geocode/xml?latlng=%f,%f&sensor=true", lat, lng];

Let's say my current location is Europe, Romania, Oradea.

If I set my iPhone to Ger开发者_C百科man for example, I get the city name in german. Somehow Google magically knows that my iPhone is German and returns geocoding data in german (Grosswardein). The problem is I would really like to have the city name untranslated (Oradea in romanian). How does google know that my iPhone's language is German, and how do I stop this. I'm not using MKReverseGeocoder because I couldn't turn this feature off but now I'm facing the exact same problem here.

Update: There are no headers sent: [request allHTTPHeaderFields] returns null. It seems Google is clairvoyant.

Update: This: [request setValue: @"*" forHTTPHeaderField: @"Accept-Language"] seems to work. As far as I understand from here I should use an asterisk. BTW Wireshark is awesome.


You could try to see if your request includes Accept-Language HTTP headers. Dunno how you send it, but it sounds like it does.

0

精彩评论

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

关注公众号