我正在尝试将 RMPolylineAnnotation 添加到我的 mapbox 地图中,但由于某种原因它没有出现。我不确定我是否缺少绘图过程中使用的调用或函数。我用来添加它的代码如下:
for (id key in dFeatures)
{
RMPolylineAnnotation *polylineAnnotation = [[RMPolylineAnnotation alloc] initWithMapView:self.rmMapView points:[dFeatures objectForKey:key]];
[polylineAnnotation setLineWidth:10.0f];
[polylineAnnotation setLineColor:[UIColor orangeColor]];
[self.rmMapView addAnnotation:polylineAnnotation];
}
dFeatures 只是一个字典,其中包含用于初始化我的 RMPolylineAnnotations 的大量点数组,见下文:
(lldb) po dFeatures
{
"Blacka_trail_a" = (
"<-1.58483448,+53.32148646> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58471249,+53.32137547> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58458351,+53.32126949> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58444752,+53.32116250> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58430553,+53.32103852> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58421054,+53.32094053> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58407455,+53.32084955> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58395256,+53.32076356> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58385757,+53.32067257> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58368158,+53.32054159> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58351160,+53.32040561> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58338261,+53.32028262> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58326062,+53.32017964> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58312563,+53.32006065> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58298264,+53.31996566> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58288065,+53.31986368> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58275166,+53.31976469> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58265767,+53.31965771> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58244669,+53.31949373> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58233870,+53.31939874> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58225070,+53.31930475> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58210072,+53.31921777> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58199972,+53.31908678> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58185674,+53.31899580> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58177574,+53.31893480> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58172075,+53.31897880> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58167276,+53.31901980> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58156977,+53.31901980> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58146679,+53.31904380> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58137080,+53.31906379> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58127481,+53.31910879> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58114483,+53.31915279> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58098685,+53.31920178> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58085687,+53.31924278> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58075388,+53.31927878> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58059590,+53.31935577> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58044492,+53.31938777> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58032894,+53.31942477> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58028094,+53.31944077> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58020495,+53.31947376> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58018396,+53.31948576> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58025895,+53.31952676> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58035494,+53.31954775> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58044993,+53.31954375> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58051892,+53.31953975> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58064190,+53.31951975> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58075789,+53.31952075> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58088088,+53.31954075> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58092187,+53.31959474> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58092788,+53.31965973> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58100187,+53.31975472> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58108386,+53.31982871> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58108987,+53.31989370> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58110287,+53.31994670> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58119786,+53.32000069> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58125185,+53.32003368> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58132685,+53.32010367> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58134685,+53.32015667> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58141484,+53.32023866> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58146084,+53.32034164> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58152184,+53.32041963> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58148684,+53.32053362> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58151284,+53.32060761> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58151285,+53.32067260> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58149085,+53.32078359> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58148386,+53.32085258> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58146186,+53.32092657> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58146187,+53.32100857> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58141288,+53.32111455> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58144588,+53.32118454> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58145188,+53.32125854> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58143788,+53.32131553> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58154087,+53.32132353> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58168385,+53.32131253> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58182084,+53.32132452> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58193682,+53.32132552> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58208081,+53.32132552> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58229278,+53.32133451> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58241577,+53.32135151> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58257975,+53.32135251> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58272973,+53.32135651> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58278472,+53.32134851> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58291471,+53.32134950> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58304369,+53.32137050> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58318768,+53.32137450> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58339265,+53.32137149> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58350164,+53.32140049> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58365262,+53.32140049> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58380260,+53.32141348> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58391859,+53.32142248> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58410357,+53.32142248> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58422656,+53.32143947> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58436954,+53.32144847> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58455452,+53.32146547> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58465651,+53.32147446> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58471850,+53.32147846> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time",
"<-1.58484048,+53.32148646> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2/28/14, 11:07:56 AM Greenwich Mean Time"
);
}
这一切似乎都加载得很好,并表明我有一个有效的 RMPolylineAnnotation 如果我在它之后设置一个断点但地图上没有显示任何内容。我注意到这出现在 lldb 中:
2014-02-28 11:36:56.579 WildSheffield[7700:70b] -[<RMShape: 0xc13aee0> display]: Ignoring bogus layer size (397983.125000, 470151.031250)
我猜这是问题的原因,但我不明白为什么图层会出现这么大,因为我的坐标数组都相当接近。
任何人都可以就如何解决此问题提供任何建议吗?我已经浏览了很多参考文档,但似乎无法弄清楚我做错了什么。谢谢
编辑1:
我注意到,当我放大地图时,现在出现以下错误:
: CGContextPathContainsPoint: 无效的上下文 0x0。这是一个严重的错误。此应用程序或它使用的库正在使用无效的上下文,从而导致系统稳定性和可靠性的整体下降。此通知是出于礼貌:请解决此问题。这将成为即将到来的更新中的致命错误。
这可能是问题的原因,但我不确定为什么会发生这种情况,因为我的路线肯定落在地图边界等范围内。是否有我没有添加的库?
编辑2:
我还注意到,虽然我正在设置我的 rmMapView 委托,但从未调用过此函数:
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
RMPolylineAnnotation 是否算作实际注释(即它不应该调用此方法吗?),for 循环肯定会将其添加到 RMMapView 中的“_visibleAnnotations”数组中。