我使用google place api,它适用于单一类型的地方。
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=23.0319597194644,72.5616482580887&radius=10000&type=atm&key=API_KEY
但是,当设置多个地方类型时,会收到错误。我使用Alamofire类。
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=23.0319597194644,72.5616482580887&radius=10000&type=atm|cafe&key=API_KEY
代码:
Alamofire.request("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=23.032166019274,72.5615383539303&radius=10000&type=atm|hospital&key=API_KEY", method: .get, parameters: NSDictionary(), encoding: URLEncoding.httpBody, headers: [:]).responseJSON { (response) in
print(response)
}
错误: FAILURE:invalidURL(“https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=23.032166019274,72.5615383539303&radius=10000&type=atm|hospital&key=API_KEY”)