问题描述
大家好 这是我的问题
我正在尝试设置一个计时器,以便在将来显示消息之前让用户走一点路。 我查看了大多数记录在案的网站,但它不起作用。
在控制台中,我每秒钟都会得到打印时间戳
------------------------------
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 (将#修改为@)