Ios GMSAutocompletePrediction.attributedFullText在swift 3.0中未提供nsmutablestring
我在swift项目中使用GMSAutocompleteFetcher搜索位置。在这里我安装了“GooglePlaces”、“GooglePlacePicker”、“GoogleMaps”和pod,并将所有内容写入链接中 但在写入textFieldDidChange后,我在委托方法中根据它得到了结果:Ios GMSAutocompletePrediction.attributedFullText在swift 3.0中未提供nsmutablestring,ios,swift3,google-places-api,gmsautocomplete,Ios,Swift3,Google Places Api,Gmsautocomplete,我在swift项目中使用GMSAutocompleteFetcher搜索位置。在这里我安装了“GooglePlaces”、“GooglePlacePicker”、“GoogleMaps”和pod,并将所有内容写入链接中 但在写入textFieldDidChange后,我在委托方法中根据它得到了结果: func didAutocomplete(with predictions: [GMSAutocompletePrediction]) { let resultsStr = NSMu
func didAutocomplete(with predictions: [GMSAutocompletePrediction]) {
let resultsStr = NSMutableString()
for prediction in predictions {
resultsStr.appendFormat("%@\n", prediction.attributedFullText)
}
但在resultsStr中获得了值:
Ca{
GMSAutocompleteMatch = "<GMSAutocompleteMatchFragment: 0x608000223940>";
}lifornia{
}
Ca{
GMSAutocompleteMatch=“”;
}利沃尼亚{
}
它应该是“California”Swift 3.0代码。 要转换的
预测.attributedFullText
属性文本首先在字符串中进行转换,然后获得字符串类型结果
func didAutocomplete(with predictions: [GMSAutocompletePrediction]) {
let resultsStr = NSMutableString()
for prediction in predictions {
resultsStr.appendFormat("%@\n", prediction.attributedPrimaryText.string)
}
print(resultsStr) //California
}
检查我的答案,如果你找到了你的解决方案,请投票并接受