If I change MKMapView's .preferredConfiguration property from .realistic to .flat, or .mapType from .hybridFlyover to .hybrid, subsequent scrolling causes a crash:
-[MTLDebugRenderCommandEncoder validateDrawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:function:]:6179: failed assertion `Draw Indexed Primitives Validation
indexBufferOffset(0) + (indexCount(864) * 2) must be <= [indexBuffer length] (12).
For example, changing:
mapView.preferredConfiguration = MKHybridMapConfiguration(elevationStyle: .realistic)
to:
mapView.preferredConfiguration = MKHybridMapConfiguration(elevationStyle: .flat)
Then, scroll the map view, and it will crash. It is OK the other way around.
Or change:
self.mapView.mapType = .hybridFlyover
to:
self.mapView.mapType = .hybrid
I've tried everything I can think of, including calling functions like these after the change:
mapView.setNeedsDisplay()
mapView.setRegion(self.mapView.region, animated: false)
.mapType and .preferredConfiguration are settable properties, so they should be possible to change. I could create a new MKMapview, but I'd have to perfectly recreate the state which is not trivial and far from ideal.
I'm just trying to work around the issue FB14553276 so my map tiles don't show tiling seems in 2D which is a new issue introduced with iOS 18. This potential workaround still shows the seems in 3D, but is better than always showing seems. Seems like whatever I do, I just can't defeat MapKit bugs and puts me in an impossible situation. :(
I've submitted Feedback this issue: FB16153802
It seems like others are experiencing the issue: https://forums.developer.apple.com/forums/thread/730780