我在swift项目中使用GMSAutocompleteFetcher来搜索地点.在这里,我使用pod安装'GooglePlaces''GooglePlacePicker''GoogleMaps',并在链接https://developers.google.com/places/ios-api/autocomplete#use_the_fetcher中编写所有内容, 但在textFieldDidChange中写入后,我得到的结果是它在委托方法中:
func didAutocomplete(with predictions: [GMSAutocompletePrediction]) {
let resultsStr = NSMutableString()
for prediction in predictions {
resultsStr.appendFormat("%@\n", prediction.attributedFullText)
}
Run Code Online (Sandbox Code Playgroud)
但在resultsStr得到的价值:
Ca{
GMSAutocompleteMatch = "<GMSAutocompleteMatchFragment: 0x608000223940>";
}lifornia{
}
Run Code Online (Sandbox Code Playgroud)
应该是"加利福尼亚"