尝试将经度/纬度拉出CoreLocation。
var locationManager: CLLocationManager = CLLocationManager()
正在尝试
latitude.text = String(format: "%.4f", latestLocation.coordinate.longitude)
latitude.text = String(format: "%.4f", latestLocation.latitude)
longitude.text = String(format: "%.4f", latestLocation.coordinate.longitude)
horizontalAccuracy.text = String(format: "%.4f",
这些不会编译给予:
"坐标不可用:从iOS7及更早版本开始使用的API在Swift中不可用。"
然而:
latestLocation.horizontalAccuracy)
altitude.text = String(format: "%.4fm", latestLocation.altitude)
verticalAccuracy.text = String(format: "%.4f", latestLocation.verticalAccuracy)
做好工作,如果我删除"坐标"在纬度示例中:
latitude.text = String(format: "%.4f", latestLocation.longitude)
latitude.text = String(format: "%.4f", latestLocation.latitude)
我得到了一个EXC_BREAKPOINT barf。
有什么想法吗?