【问题标题】:CLLocationManager delegates still called even after the viewcontroller it is in was poppedCLLocationManager 委托即使在它所在的视图控制器被弹出后仍然被调用
【发布时间】:2015-10-26 08:54:48
【问题描述】:

我有一个视图控制器,我会在很多情况下推送和弹出,我注意到即使在视图控制器弹出后 CLLocationManager 实例仍然存在。

我应该如何解决这个问题?

我正在使用 swift 但我发现即使在弹出 ViewController 之后对象仍然存在。

有吗?

【问题讨论】:

    标签: ios swift swift2 core-location cllocationmanager


    【解决方案1】:

    当您点击返回按钮时,在以下函数中将 CLLocationManager 委托值设置为“nil”。

    override func viewWillDisappear(animated: Bool) {
        //Set Delegate to nil here...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-03
      • 2012-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-25
      相关资源
      最近更新 更多