简体   繁体   English

CLLocation时间戳始终为零

[英]CLLocation Timestamp is always zero

The CLLocation timestamp is always zero on iPhone 6+, IOS 11.4, Xcode 9.4.1. 在iPhone 6 +,IOS 11.4,Xcode 9.4.1上,CLLocation时间戳始终为零。

Latitude: 30.598748 Longitude: -97.820877 Altitude: 308.921658 HAccuracy: 10.000000 VAccuracy: 4.000000 Timestamp: 0.000000 <====== 纬度:30.598748经度:-97.820877海拔:308.921658 H精度:10.000000 V精度:4.000000时间戳:0.000000 <======

Is there some setting that will give me accurate timestamp? 有一些设置可以给我准确的时间戳吗? Here is the code that prints it: 这是打印它的代码:

print("Latitude: \(String(format: "%.6f", location.coordinate.latitude))")
print("Longitude: \(String(format: "%.6f", location.coordinate.longitude))")
print("Altitude: \(String(format: "%.6f", location.altitude))")
print("HAccuracy: \(String(format: "%.6f", location.horizontalAccuracy))")
print("VAccuracy: \(String(format: "%.6f", location.verticalAccuracy))")
print("Timestamp: \(String(format: "%.6f", location.timestamp as CVarArg))")

The timestamp is an object of type Date . timestampDate类型的对象。 It should print with this: 它应该打印与此:

print("Timestamp: \(String(format: "%@", location.timestamp))")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM