Google 为 iOS 放置 componentrestrictions 国家/地区

Google Places componentrestrictions Country for iOS

目前我在我们的网站上使用以下 javascript 来限制对美国的搜索,效果很好。

autocomplete = new google.maps.places.Autocomplete((document.getElementById('autoAddress')), {types: ['geocode'],componentRestrictions: {country: 'US'}
});

我四处搜寻,试图找到一种方法再次将我们的 iPhone 应用程序的搜索限制在一个国家/地区,但没有成功。 componentRestrictions: {country: 'US'} 在 javascript 中发挥了作用,但我似乎无法在 iOS 中找到等效项。

目前我正在使用以下示例中的代码,它看起来非常标准并且运行良好;

https://github.com/mrugrajsinh/MVAutocompletePlaceSearchTextField

您是否有 iOS 的 Google 个地点 API 的最新版本 (1.11.0)?这是在该版本中添加的(请参阅 release notes)。

在 1.11.0 中,这是通过在 GMSAutocompleteFilter 上设置 country 属性 来完成的。