gpt4 book ai didi

ios - GMSServices GMSGeocoder reverseGeocodeCoordinate IOS返回结果的语言

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:13:21 25 4
gpt4 key购买 nike

我有两个成对使用的应用程序,都使用 GMSServices 的 GMSGeocoder 进行反向地理编码坐标搜索。但在第一个结果中,结果以英语显示,在其他结果中以设备本地语言显示。设备相同

我查了很多,发现现在没有办法让GMSGeocoder使用指定语言的结果。这是不可能的,我们应该改用 google API 请求。但它以某种方式起作用,我不知道如何让第二个应用程序仅以英语返回结果。

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

如何在不考虑设备本地化的情况下为 GMSServices 设置英语?

Local device language present No local languge present

最佳答案

GMSGeocoder 向您发送了县名,但没有发送国家/地区 ISO 代码。

您可以使用 native CLGeocoder 类从纬度和经度获取 counytyISOcode。例如:

CLLocation *location = (your location)
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:
^(NSArray* placemarks, NSError* error){
if ([placemarks count] > 0)
{
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"Your counry is %@",placemark. ISOcountryCode);
}
}];

关于ios - GMSServices GMSGeocoder reverseGeocodeCoordinate IOS返回结果的语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31924147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com