So for our maps, we are using MapKit. We overlay a layer using MKPolygons above the map. This feature has been working since iOS15 but since 16.1 we get the following error and the app freezes (does not crash).
-
[VKDefault] Exceeded Metal Buffer threshold of 50000 with a count of 50892 resources, pruning resources now (Time since last prune:6.497636): Assertion with expression - false : Failed in file - /Library/Caches/com.apple.xbs/Sources/VectorKit/src/MDMapEngine.mm line - 1363
-
Metal API Validation Enabled [PipelineLibrary] Mapping the pipeline data cache failed, errno 22
Another interesting log is the following
[IconManager] No config pack found for key SPR London Landmarks
Any idea how to manually clear the metal cache?
2
Answers
There seems to be a problem related to the number of MKOverlayRenderers making draw calls. Having more than a few seems to trigger this issue. Using MKMultiPolyline/Polygon seems to be a workaround but that does not work if you need to support iOS 12 or style the lines and polygons independently.
I was reading through this Apple Developer thread: Drawing MKPolylines on map make app unresponsive. Anybody else have this problem ? and I think this answer could be interesting for you to find a solution for your problem. As I am currently also working on it, I will let you know when I have a solution.