[英]GMSAutocompleteResultsViewControllerDelegate conforming to protocol Swift
我正在嘗試使用IOS的Google Maps SDK中的一些示例代碼。 下面的代碼給我一個錯誤消息:類型ViewController
不符合協議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)
}
}
不幸的是,該站點上的示例代碼不正確。 協議方法實際上稱為didFailAutocompleteWithError ,而不是didAutocompleteWithError
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.