ios - 如何将 CoreLocation 坐标转换为字符串?

标签 ios string oop swift core-location

func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
    var user_lat = manager.location.coordinate.latitude
    var user_long = manager.location.coordinate.longitude
    self.locationManager.stopUpdatingLocation()
}

我试过 String(manager.location.coordinate.latitude) 但这似乎不起作用。

最佳答案

尝试格式

let user_lat = String(format: "%f", manager.location.coordinate.latitude)
let user_long = String(format: "%f", manager.location.coordinate.longitude)

关于ios - 如何将 CoreLocation 坐标转换为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29466405/

相关文章:

ios - 不在 guard 语句中使用展开

ios - 是否可以为 CNContactViewController 添加自定义导航栏?

ios - Unity - 使用 Fabric 导致 iOS 出现问题

java - 插入字符串的某些部分

objective-c - Clean NSLog - 没有时间戳和程序名称

python - 字符串格式 : Replace "%0 %1 %2" with tuple with 0, 1,2 索引

c# - 为什么 String.CompareTo 不考虑字符串长度?

php - 是否可以在一次操作中构造 PHP 对象并设置它们的变量?

php - 使用一对一的表关系有什么好处? (MySQL)

php - 是否有可能捕获工厂中的对象抛出的任何异常?