如何从PlaceID或GMSPlace获取GMSAddress [英] How to get GMSAddress from PlaceID or GMSPlace

查看:532
本文介绍了如何从PlaceID或GMSPlace获取GMSAddress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iOS版Google Places API的自动填充功能,并返回placeID。我如何从placeID获取GMSAddress?我目前使用lookupPlaceID来获得GMSPlace,然后使用reverseGeocodeCoordinate从GMSPlace中的坐标中获取GMSAddress。但它要求Google API 3次:AutoComplete,lookupPlaceID,reverseGeocodeCoordinate。

有没有办法直接从PlaceID或GMSPlace获取GMSAddress?

解决方案

这是Google Maps SDK for iOS 1.1.0的一个bug。请参阅此处

正如文档所述此处< 地址属性应该在 GMSPlace 上显示 GMSAddress c>实例。



我刚刚切换到使用REST API。为API编写快速封装并完全抛弃Google SDK也不错。如果您使用Alamofire ping我,我可以分享我写的内容。


I am using Autocomplete of Google Places API for iOS, and it returns placeID. How can I get GMSAddress from the placeID? I currently use lookupPlaceID to get GMSPlace, and then use reverseGeocodeCoordinate to get GMSAddress from coordinate in GMSPlace. But it request Google API 3 times: AutoComplete, lookupPlaceID, reverseGeocodeCoordinate.

Is there any way to get GMSAddress from PlaceID or GMSPlace directly?

解决方案

This is a bug with 1.1.0 of the Google Maps SDK for iOS. See here.

As the documentation states here, the address property should expose a GMSAddress on GMSPlace instances.

I've just switched to using the REST API. It's not too bad to write a quick wrapper for the API and ditch the Google SDK completely. If you are using Alamofire ping me and I may be able to share what I've written.

这篇关于如何从PlaceID或GMSPlace获取GMSAddress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆