将坐标附加到MapBox MGLPolyline

时间:2018-08-24 20:34:17

标签: ios swift mapbox unsafe-pointers

我试图将坐标附加到用于注释MapBox地图的线上。

databases具有附加坐标的以下功能:

MGLPpoyline

我一生都无法弄清楚如何将单个坐标点传递给上述功能。 UnsafePointer位让我去吃香蕉。我一直在网上寻找信息,但是尝试使用的任何解决方案均会出现以下运行时错误:

  

线程1:致命错误:在展开可选值时意外发现nil

我手头只有一个普通的appendCoordinates(_ coords: UnsafePointer<CLLocationCoordinate2D>, count: UInt) 实例,该实例在函数调用时已被验证为包含有效坐标。

这是我尝试过的事情之一:

CLLocationCoordinates2D

顺便说一句,下面的命令运行得很好:

let coord = currentLocation!.coordinate // Verified valid
var coords: [CLLocationCoordinate2D] = [coord]
aLine.appendCoordinates(&coords, count:UInt(coords.count))  // Unexpectedly found nil...

如果我不认识我,我很抱歉,但是我对Swift还是有点陌生​​。

使用中上述功能的任何帮助或示例,将不胜感激。

0 个答案:

没有答案