【问题标题】:How to release memory occupied by GMSPlacePickerViewController when I selecting different positions?选择不同位置时如何释放 GMSPlacePickerViewController 占用的内存?
【发布时间】:2018-04-27 10:02:39
【问题描述】:

我遇到了与 GMSPlacePickerViewController 相关的问题,我试图使用谷歌提供的 GMSPlacePickerViewController 多次选择位置。经过几次尝试,我将收到“网络连接丢失”的内存警告。警报。 所以任何人都知道我该如何解决这个问题。

提前致谢。

【问题讨论】:

    标签: ios swift google-maps google-places-api


    【解决方案1】:

    请在 didReceiveMemoryWarning() 方法中输入此代码

    override func didReceiveMemoryWarning() 
    {
        super.didReceiveMemoryWarning()
        URLCache.shared.removeAllCachedResponses()
        URLCache.shared.diskCapacity = 0
        URLCache.shared.memoryCapacity = 0
        self.viewMap.clear()
        self.viewMap.reloadInputViews()
    
    }
    

    【讨论】:

    • 当我清除 mapview 时,只有内存下降,而不是通过删除缓存。你能解释一下为什么会这样吗?谢谢
    猜你喜欢
    • 1970-01-01
    • 2023-03-16
    • 2015-10-26
    • 2013-02-23
    • 1970-01-01
    • 1970-01-01
    • 2012-03-28
    • 2015-08-10
    • 2012-08-13
    相关资源
    最近更新 更多