在国外使用我的应用时,google GMSGeocoder
会自动以本地语言返回响应。如何设置它始终以英语返回响应?
我正在使用GMS SDK 1.7,我的代码是这样的:
GMSGeocoder *geoCoder = [[GMSGeocoder alloc] init];
[geoCoder reverseGeocodeCoordinate:self.cellLocation.coordinate completionHandler:^(GMSReverseGeocodeResponse *respones, NSError *err) {
if([respones firstResult]) {
GMSAddress* address = [respones firstResult];
NSString* fullAddress = [NSString stringWithFormat:@"%@, %@",address.thoroughfare, address.locality];
self.theTextField.text = fullAddress;
} else {
self.theTextField.text = @"";
}
}];
最佳答案
只需将其更改为您的语言参数
int main(int argc, char * argv[])
{
@autoreleasepool {
//For Google Maps hebrew response
//[[NSUserDefaults standardUserDefaults] setObject:@[@"en"] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] setObject:@[@"he",@"he-IL"] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}