本文介绍了GMSServices GMSGeocoder reverseGeocodeCoordinate在IOS中返回结果的语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两对应用程序,都使用来自GMSServices的GMSGeocoder进行reverseGeocodeCoordinate搜索。但是第一个结果是用英语和其他语言 - 以设备本地语言。设备是相同的



我搜索了很多,发现现在没有办法让GMSGeocoder使用指定的语言来获得结果。这是不可能的,我们应该使用谷歌API请求。但它有点作用,而且我不知道如何以英文显示第二次应用程序返回结果。



类似的问题涉及mapView - 同一设备上的不同语言。 p>

如何为GMSServices设置英语而不管设备本地化?


解决方案



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions



add

  NSArray * languag es = [[NSUserDefaults standardUserDefaults] objectForKey:@AppleLanguages]; 
if(![[languages firstObject] isEqualToString:@en]){
[[NSUserDefaults standardUserDefaults] setObject:@ [@en] forKey:@AppleLanguages];
[[NSUserDefaults standardUserDefaults] synchronize];
}

这适用于我


I have two applications which used in pair and both used GMSGeocoder from GMSServices for reverseGeocodeCoordinate search. But in first one results are coming in english, on other - in device local language. Device is the same.

I searched a lot, and found that now is no ways to make GMSGeocoder use specified language for result. It is impossible and we should use google API requests instead. But it works somehow, and i have no idea how to make second application return results in english language only.

Similar concerns mapView - different languages on the same device.

How to set english for GMSServices regardless device localization?

解决方案

Copy paste answer from stackoverflow.com/a/24333593/4195406

In - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

add

NSArray *languages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
    if (![[languages firstObject] isEqualToString:@"en"]) {
        [[NSUserDefaults standardUserDefaults] setObject:@[@"en"] forKey:@"AppleLanguages"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

This works for me

这篇关于GMSServices GMSGeocoder reverseGeocodeCoordinate在IOS中返回结果的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 07:19