【发布时间】:2019-02-21 18:23:34
【问题描述】:
我有以下代码可以检索我存储在 Google Firestore 中的坐标:
let locationsRef = db.collection("locatioInfo")
locationsRef.getDocuments { (querySnapshot, err) in
if let err = err {
print("Error receiving Firestore snapshot: \(err)")
} else {
for document in querySnapshot!.documents {
print("\(document.documentID) => \(document.data())")
}
}
}
产生这个输出:
location1 => ["geopoint": <FIRGeoPoint: (50.086421, 14.452333)>]
location2 => ["geopoint": <FIRGeoPoint: (50.086442, 14.452268)>]
我的问题是:如何将获取的 FIRGeoPoints 转换为 CLLocationCoordinates2D 或者简单地说:如何使用这些坐标并在地图上显示它们?
我有一个 MKAnnotationView 已经设置的广告用于硬编码坐标,现在我需要显示获取的坐标。希望这已经足够清楚了,在此先感谢。
【问题讨论】:
标签: ios swift firebase google-cloud-firestore mapkit