我想在谷歌地图上显示路线,但出现此错误
我只调用了一次这个api,但是第一次出现这个错误
我该怎么办?
“OVER_QUERY_LIMIT”
let url = "https://maps.googleapis.com/maps/api/directions/json?origin=\(origin)&destination=\(destination)&mode=driving"
Alamofire.request(url).responseJSON { response in
//print(response.request as Any) // original URL request
//print(response.response as Any) // HTTP URL response
//print(response.data as Any) // server data
//print(response.result as Any) // result of response serialization
let json = try! JSON(data: response.data!)
let routes = json["routes"].arrayValue
print(json)
// print route using Polyline
DispatchQueue.global(qos: .default).async(execute: {() -> Void in
// Do something...
DispatchQueue.main.async(execute: {() -> Void in
// self.hideHUD()
})
})
for route in routes
{
let routeOverviewPolyline = route["overview_polyline"].dictionary
let points = routeOverviewPolyline?["points"]?.stringValue
let path = GMSPath.init(fromEncodedPath: points!)
let polyline = GMSPolyline.init(path: path)
polyline.strokeWidth = 4
polyline.strokeColor = #colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1)
polyline.map = self.mapView
}
最佳答案
从 2018 年 9 月 10 日开始,巴西、加拿大和印度自助服务客户的使用量将限制为每月 200 美元。这种情况是暂时的。有关详细信息,请参阅 map 常见问题解答。新的即用即付定价计划现已对 Google Maps Platform API 生效。
关于ios - 谷歌地图方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52677040/