我正在尝试从坐标列表中在 MKMapView 上绘制路径,但出现两个错误。
这是代码(错误行有注释):
var routes = [CoordVO]();
routes.append(pn)
routes.appe...
var a = UInt(sizeof(CLLocationCoordinate2D)) * UInt(routes.count)
var pointArr = malloc(a)
for var idx = 0; idx < routes.count; idx++ {
var obj = routes[idx]
var workingCoordinate:CLLocationCoordinate2D!
workingCoordinate.latitude=obj.lat
workingCoordinate.longitude=obj.lng
var point = MKMapPointForCoordinate(workingCoordinate)
pointArr[idx] = point; // MKMapPoint is not convertible to Void
}
var routeLine = MKPolyline(points: pointArr, count: routes.count) // Void is not identical to MKMapPoint
self.mapView.addOverlay(routeLine)
free(pointArr);