Reborned BBIAJ
Reborned BBIAJ

Reputation: 29

MapKit & iOS 16.4 Issue while rendering polylines

How you guys doing?

So, I have a iOS App, made in Swift. In this app I have a Map, made with Map Kit and on the iOS 16.4 the polylines don't render correctly.

I have custom Tiles, but I don't think that's the problem because on the above versions it works like a charm.

I have searched fixes and did some, but till now none has worked. Plus, when my tiles flickering, when I zoom in/out the poly line appears but when it stops flickering it disappears...

I get an error on the console, but the error appears even with out the Polyline created, but I searched a bit and didn't found any relevant

[VKDefault] Missing DaVinciGroundRenderables for ground mesh layer

Here's my Polyline rendering:

if overlay is MKPolyline {
      let polylineRenderer = MKPolylineRenderer(overlay: overlay)
      polylineRenderer.strokeColor = UIColor.orange
      polylineRenderer.lineWidth = 7.0
      polylineRenderer.alpha = 1.0
      return polylineRenderer

If someone has some hints or have done a fix, I would appreciate some help :)

Thanks & Regards ~Peter

Upvotes: 1

Views: 2461

Answers (1)

Reborned BBIAJ
Reborned BBIAJ

Reputation: 29

I found an answer, the problem was because the layers of the Polylines, and so, with the new iOS, the polyline layers was behind the other layers I had, like the tiles. I fixed it by forcing it, to go alway to the top.

A bit of code:

  func addOverlayOnTop(_ overlay: MKOverlay) {
    if let last = self.overlays.last {                  // its not the first overlay
      self.insertOverlay(overlay, above: last)        // make sure to add it above all
    } else {                                            // its the first one
      self.addOverlay(overlay)                        // just add it
    }
  }
}

And oh the class that creates the polylien, call this function.

Upvotes: 1

Related Questions