在iPhone 6 +,IOS 11.4,Xcode 9.4.1上,CLLocation时间戳始终为零。
纬度:30.598748 经度:-97.820877 海拔:308.921658 精度:10.000000 准确度:400万 时间戳记:0.000000 <======
是否有一些设置可以给我准确的时间戳记?这是打印它的代码:
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))")
答案 0 :(得分:0)
timestamp
是Date
类型的对象。它应该显示以下内容:
print("Timestamp: \(String(format: "%@", location.timestamp))")