使用 Firebase 作为后端,我有一系列纬度和经度坐标字符串,如何将它们转换为 CLLocationCooperative2D 以便我可以将它们用于注释?
这是每次更新时从 Firebase 获取信息的代码
var UpdateRef = Firebase(url:"https://ici.firebaseio.com/users")
UpdateRef.observeEventType(.ChildChanged, withBlock: { (snapshot) in
let MomentaryLatitude = snapshot.value["latitude"] as? String
let MomentaryLongitude = snapshot.value["longitude"] as? String
let ID = snapshot.value["ID"] as? String
println("\(MomentaryLatitude)")
var Coordinates = CLLocationCoordinate2D(latitude: MomentaryLatitude as
CLLocationDegrees, longitude: MomentaryLongitude as CLLocationDegrees)
}
最后一行不起作用,我应该用什么来代替?
Use the doubleValue
财产:
let MomentaryLatitude = (snapshot.value["latitude"] as NSString).doubleValue
let MomentaryLongitude = (snapshot.value["longitude"] as NSString).doubleValue
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)