【发布时间】:2017-04-24 22:31:06
【问题描述】:
正如主题所说,当视图出现而不调用 startUpdatingLocation 时,我想通过下面的代码获取当前位置。这可能吗?
curLocation = locationManager.location
我正在运行的应用程序在开始运行时会调用 startUpdatingLocation,所以我不想在视图出现方法中调用它。
非常感谢!
【问题讨论】:
标签: swift locationmanager
正如主题所说,当视图出现而不调用 startUpdatingLocation 时,我想通过下面的代码获取当前位置。这可能吗?
curLocation = locationManager.location
我正在运行的应用程序在开始运行时会调用 startUpdatingLocation,所以我不想在视图出现方法中调用它。
非常感谢!
【问题讨论】:
标签: swift locationmanager
我不确定您到底在追求什么,但您可以使用 requestLocation() 一次获取当前位置。它将使用结果调用 locationmgr(didUpdateLocations)。
【讨论】: