【发布时间】:2015-06-04 11:54:10
【问题描述】:
我正在尝试使用 iOS 版 Google Places API 获取某个地点的详细信息。尝试调用 lookUpPlaceID 函数时,收到以下 Swift 编译器错误:
无法使用类型为“(String, callback: (GMSPlace!, _) -> Void)”的参数列表调用“lookUpPlaceID”
let placeID = "ChIJV4k8_9UodTERU5KXbkYpSYs"
placesClient!.lookUpPlaceID(placeID, callback: { (place: GMSPlace!, error) -> Void in
if error != nil {
println("lookup place id query error: \(error.localizedDescription)")
return
}
if place != nil {
println("Place name \(place.name)")
println("Place address \(place.formattedAddress)")
println("Place placeID \(place.placeID)")
println("Place attributions \(place.attributions)")
} else {
println("No place details for \(placeID)")
}
})
我在这里使用 Google Places API 文档中提供的示例代码:
https://developers.google.com/places/ios/place-details#get-place
placesClient 是 GMSPlacesClient 类型的对象。在前面的代码中,我能够成功调用placesClient autcompleteQuery 函数,所以我认为这不是我的placesClient 的问题。
任何帮助或建议将不胜感激。
【问题讨论】:
标签: ios swift google-places-api