全新的 Xcode 版本,除了删除大量添加空函数调用的地方外,还引入了一个有趣的问题,即用一段简单的代码绘制大地路径:
func drawPolyline(from startLocation: CLLocation, endLocation:CLLocation) {
let point1 = startLocation.coordinate
let point2 = endLocation.coordinate
var points: [CLLocationCoordinate2D]
points = [point1, point2]
var coordinates=points[0]
let geodesic = MKGeodesicPolyline(coordinates: &coordinates, count:2)
self.mapView.add(geodesic)
}
编译器抱怨:
'init(coordinates:count:)' 的模糊使用
当我尝试点击给定的选项时,我总是被引导到那条线。我试图清理项目无济于事。