Mapkit & iOS 16.4 Issue While Rendering Polylines

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

4

1 Answer

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.
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.