Google maps swift 3中的谷歌地图中未显示路径
我想在谷歌地图中显示路径。但我无法指明我的道路。请帮帮我。这是我的密码。我在斯威夫特花了很多时间。任何帮助都将不胜感激。提前谢谢Google maps swift 3中的谷歌地图中未显示路径,google-maps,swift3,Google Maps,Swift3,我想在谷歌地图中显示路径。但我无法指明我的道路。请帮帮我。这是我的密码。我在斯威夫特花了很多时间。任何帮助都将不胜感激。提前谢谢 let camera = GMSCameraPosition.camera(withLatitude: 48.4843822562792, longitude: 35.0635632500052, zoom: 6) let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
let camera = GMSCameraPosition.camera(withLatitude: 48.4843822562792, longitude: 35.0635632500052, zoom: 6)
let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
self.view = mapView
let manager = AFHTTPSessionManager()
manager.requestSerializer = AFJSONRequestSerializer()
manager.responseSerializer.acceptableContentTypes = nil
let urlString = "https://maps.googleapis.com/maps/api/directions/json?origin=48.4843822562792,35.0635632500052&destination=48.4893899423081,35.0640017911792&waypoints=48.4833428800255,35.0710221379995|48.4887622031403,35.0573639944196&key=AIzaSyDvS9TbaQ1WzP_3YX6TBrjoTNGhnFa0MBY"
let urlwithPercentEscapes = urlString.addingPercentEncoding( withAllowedCharacters: .urlQueryAllowed)
manager.get(urlwithPercentEscapes!, parameters: nil, success: { (operation, response) in
let parsedData = JSON(response)
var path = GMSPath.init(fromEncodedPath: parsedData["routes"][0]["overview_polyline"]["points"].string!)
//GMSPath.fromEncodedPath(parsedData["routes"][0]["overview_polyline"]["points"].string!)
print(path!)
var singleLine = GMSPolyline.init(path: path)
singleLine.strokeWidth = 7
singleLine.strokeColor = UIColor.green
singleLine.map = self.mapView
}, failure: { (operation, error) in
})
在objc中检查此答案在objc中检查此答案