【发布时间】:2019-12-16 03:06:58
【问题描述】:
有没有办法从 lat long 或地址获取Google Place ID?我已经通过 lat long 获取了位置地址,但 Place ID 没有运气。谁能帮帮我吗?
我的要求很简单。我有很长。使用 lat long 获取地址。现在我只需要那个地址的地点 ID。
这是我的代码:
let geocoder = GMSGeocoder()
geocoder.reverseGeocodeCoordinate(coordinate) { (response, error) in
if error != nil{
print("reverse geodcode fail: \(error!.localizedDescription)")
}else{
if let places = response?.results(){
if let place = places.first{
print("GMS Address Place-->", place)
if let lines = place.lines{
print("GEOCODE: Formatted Address: \(lines[0])")
}
}else{
print("GEOCODE: nil first in places")
}
}else{
print("GEOCODE: nil in places")
}
}
【问题讨论】:
-
你能弄清楚这个吗?我也遇到了同样的问题。
标签: ios swift google-maps google-maps-api-3