Google Places componentrestrictions适用于iOS的国家/地区

Google Places componentrestrictions Country for iOS

本文关键字:国家 地区 iOS Places componentrestrictions 适用于 Google      更新时间:2023-09-26

目前我在我们的网站上使用以下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 Places API最新版本(1.11.0)吗?这是在该版本中添加的(请参阅发行说明)。

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