gpt4 book ai didi

swift - 如何在 NsmutableArray 中快速获取 google 地点 id?

转载 作者:行者123 更新时间:2023-11-30 13:50:48 27 4
gpt4 key购买 nike

我想从 google place API 中提取地点 ID这是示例代码

 for result in results! {
if let result = result as? GMSAutocompletePrediction {
print("Result \(result.attributedFullText) with placeID \(result.placeID)")

self.placeId.addObject(result.placeID)
print("placeId==\(self.placeId)")

// self.placeId.addObject(result.placeID)
}
// self.placeId.addObject(result.placeID)
// print("placeId==\(self.placeId)")
}

当我添加 self.placeId.addObject(result.placeID) 时,我崩溃了

我在 Nslog 中的结果值为

Result Restaurant{
GMSAutocompleteMatch = "<GMSAutocompleteMatchFragment: 0x7b85acc0>";
}-A, Limpopo, South Africa{
} with placeID ChIJ91Ja9qr8wB4RJWDoiYanNIo
Result Restaurant{
GMSAutocompleteMatch = "<GMSAutocompleteMatchFragment: 0x7b87d2e0>";
} Chayo, Mexico{
} with placeID ChIJP6GUHEmTvIYRc3CD5bAotiE
Result Restaurant{
GMSAutocompleteMatch = "<GMSAutocompleteMatchFragment: 0x7b87d990>";
}e, Mexico{
} with placeID ChIJrV4AvelmyIYR7-jos-aGxDY

最佳答案

使用result.attributedFullText.string而不是result.attributedFullText

关于swift - 如何在 NsmutableArray 中快速获取 google 地点 id?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34309035/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com