Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios GMSAutocompletePrediction.attributedFullText在swift 3.0中未提供nsmutablestring_Ios_Swift3_Google Places Api_Gmsautocomplete - Fatal编程技术网

Ios GMSAutocompletePrediction.attributedFullText在swift 3.0中未提供nsmutablestring

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

我在swift项目中使用GMSAutocompleteFetcher搜索位置。在这里我安装了“GooglePlaces”、“GooglePlacePicker”、“GoogleMaps”和pod,并将所有内容写入链接中 但在写入textFieldDidChange后,我在委托方法中根据它得到了结果:

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
    }

检查我的答案,如果你找到了你的解决方案,请投票并接受