CLLocation 和时间戳

问题描述

大家好 这是我的问题

我正在尝试设置一个计时器,以便在将来显示消息之前让用户走一点路。 我查看了大多数记录在案的网站,但它不起作用。

在控制台中,我每秒钟都会得到打印时间戳

                   ------------------------------


extension TrackHistoryTableViewController: CLLocationManagerDelegate {

func locationManager(_ manager: CLLocationManager,didUpdateLocations locations: [CLLocation]) {
    let seconds = 300.0
    
    if prevIoUsLocation == nil { prevIoUsLocation = locations.first
    } else {
        guard let newLocation = locations.last else { return }
        
        if newLocation.speed > 0  {
            dispatchQueue.main.asyncAfter(deadline: .Now() + seconds) {
                print("Too slow")
                print(newLocation.timestamp)
            }
            if newLocation.speed < 1  {
         
                dispatchQueue.main.asyncAfter(deadline: .Now() + seconds) {
                    print("Too slow")
                    print(newLocation.timestamp)
                }
                
            } else if newLocation.speed >= 8.8  {
                
                dispatchQueue.main.asyncAfter(deadline: .Now() + seconds) {
                    print("too fast")
                    print(newLocation.timestamp)

                }
                print("too fast")
                print(newLocation.timestamp)

            }
        } else {
            locationManager?.startUpdatingLocation()
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...