gpt4 book ai didi

ios - 在我们之前尚未在 GMSPlacePickerViewController 实例上设置委托(delegate)

转载 作者:可可西里 更新时间:2023-11-01 03:55:37 27 4
gpt4 key购买 nike

我已经使用 IOS 和 Google Maps Api 玩了几天,两天前 API 升级到 2.3 版,不推荐使用 GMSPlacePicker。

Deprecation notice: GMSPlacePicker Notice: The implementation of the place picker has changed. As of version 2.3 of the Google Places API for iOS, the GMSPlacePicker class is deprecated, replaced by GMSPlacePickerViewController. Use of the GMSPlacePicker class will only be supported until May 1, 2018. We recommend that you update your code to use GMSPlacePickerViewController when possible.

在我的代码中,我切换到 GMSPlacePickerViewController 但是我仍然在日志中收到一条错误消息:

Places API warning: A delegate has not been set on an instance of GMSPlacePickerViewController before use. Note that this may result in undefined behavior such as being unable to dismiss screens, not being notified of selections, and being unable to correctly manage object lifecycle.

即使我的类(class)正在扩展委托(delegate)

class ReportController: UIViewController,UIPickerViewDelegate,UIPickerViewDataSource,GMSPlacePickerViewControllerDelegate{
// code goes here
}

知道如何解决这个问题吗?

最佳答案

我也有同样的问题,我通过使用这段代码解决了这个问题。这是代码。

let config = GMSPlacePickerConfig(viewport: nil)
let placePicker = GMSPlacePickerViewController(config: config)
placePicker.delegate = self
present(placePicker, animated: true, completion: nil)

希望这也能解决你的问题

关于ios - 在我们之前尚未在 GMSPlacePickerViewController 实例上设置委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44340960/

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