gpt4 book ai didi

ios Swift - API GoogleMaps - 不符合协议(protocol) GSMAutocompleteViewControllerDelegate

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

我正在尝试在 iOS 应用程序中使用 API GoogleMaps 进行自动完成,但我无法解决问题,我搜索了它,但似乎我是唯一拥有它的人.

MyViewController doesn't conform to protocol GSMAutocompleteViewControllerDelegate

class MyViewController: UIViewController {

@IBAction func onLaunchClicked(sender: AnyObject) {
let acController = GMSAutocompleteViewController()
acController.delegate = self
self.presentViewController(acController, animated: true, completion: nil)
}
}

extension MyViewController: GMSAutocompleteViewControllerDelegate {

func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithPlace place: GMSPlace!) {
// The user has selected a place.
self.dismissViewControllerAnimated(true, completion: nil)
}

func viewController(viewController: GMSAutocompleteViewController!, didAutocompleteWithError error: NSError!) {
self.dismissViewControllerAnimated(true, completion: nil)
}

func wasCancelled(viewController: GMSAutocompleteViewController!) {
self.dismissViewControllerAnimated(true, completion: nil)
}
}

我似乎没有所需的所有协议(protocol),但无法掌握它。

感谢您的帮助:)

最佳答案

尝试添加:

func viewController(viewController: GMSAutocompleteViewController!, didFailAutocompleteWithError error: NSError!) {

}

关于ios Swift - API GoogleMaps - 不符合协议(protocol) GSMAutocompleteViewControllerDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34676576/

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