MapKit & iOS 16.4 Issue while rendering polylines

May 2024 ยท 2 minute read

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

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobm9pZ2aDd3yOppipo5mpeqq70mZob2VkYra0v9SeZLCgmaGybr7Ep5ueqpmjtG68zqWwpaGemsA%3D