gpt4 book ai didi

swift - 符合 Swift 协议(protocol)的 GMSAutocompleteResultsViewControllerDelegate

转载 作者:行者123 更新时间:2023-11-28 06:50:15 25 4
gpt4 key购买 nike

我正在尝试使用适用于 IOS 的 Google Maps SDK 中的一些示例代码。下面的代码给我一条错误消息:类型 ViewController 不符合协议(protocol) GMSAutocompleteResultsViewControllerDelegate。请参阅下面的代码。有谁知道什么是不符合的。

extension ViewController: GMSAutocompleteResultsViewControllerDelegate {
func resultsController(resultsController: GMSAutocompleteResultsViewController!,
didAutocompleteWithPlace place: GMSPlace!) {
searchController?.active = false
// Do something with the selected place.
print("Place name: ", place.name)
print("Place address: ", place.formattedAddress)
print("Place attributions: ", place.attributions)
}

func resultsController(resultsController: GMSAutocompleteResultsViewController!,
didAutocompleteWithError error: NSError!){
// TODO: handle the error.
print("Error: ", error.description)
}
}

最佳答案

很遗憾,网站上的示例代码不正确。协议(protocol)方法实际上称为 didFailAutocompleteWithError ,而不是 didAutocompleteWithError

关于swift - 符合 Swift 协议(protocol)的 GMSAutocompleteResultsViewControllerDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35109231/

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