iOS 13.2 removing overlay from MapKit causing map to flicker

A similar thing is happening to me. I have an app that hasn't changed in several months, but when I upgraded to iOS 13.2, it started misbehaving. The app has a mapView that renders MKTileOverlays. A 2x2 grid of tiles that surrounds the center blue dot is blinking continuously at a rate of once per second, at all zoom levels. I was able to capture the screen (on an iPhone) right when it blinked, and I can see it's showing a number of tiles at higher zoom levels.

In the picture below, the map is at zoom level 14. I outlined the 2x2 blinking tiles in green. When it blinks, several tiles at zoom level 16 (outlined in orange) and zoom level 17 (outlined in purple) appear.

The higher zoom-level tiles only appear if I previously zoomed up to that level in those areas. Otherwise, the 2x2 blinking grid is empty.

enter image description here


Here is the reply I received from Apple Developer Technical Support on 12/5/2019...

What you’re seeing is a known bug in MapKit. I wanted to pass along some additional information to help reduce how often you may see this in your real app. A common pattern that some apps use in the MKMapView usage is to do frequent updates to their overlays, such as removing all overlays at once, and then adding some subset (or all) of them back. In particular, if this is done to the hot code paths for user driven events, such as pinching and zooming the map, the blinking tile behavior is exacerbated.

In the case of the sample [provided by P. Stern], this is the location manager’s location update, which can be called at 60 Hertz in some circumstances. You can do something like a distance comparison and only update the polyline if there’s a significant enough change in the coordinate since the last time you replaced the polyline to be meaningful to the user for your trail use case. Applying this to your real app, please audit the points where you add and remove overlays, and try to reduce the number of times those methods get called. This won’t eliminate the tile blinking problem, but may reduce its frequency as a way to mitigate the effects of our issue.

When looking at your overlays, also consider why you need to add and remove overlays from the map, and if there are opportunities to do so in bulk, but rarely. Another common pattern I see often is trying to keep track of the overlays to keep memory usage down, and continually updating the overlays added to the map to reflect only those relevant to the user’s location or visible map rectangle. However, the MKOverlay objects themselves are usually not large, because they are only a coordinate and a bit of data, so the memory saved by these techniques is often in the kilobyte to low megabyte range, which isn’t much improvement when an app with a map needs 100 MB just for the map, let alone the rest of the app’s data and view controllers.

Final Update:

The issue seems to have been resolved by Apple. I am using iOS 13.7 (Xcode 12) and the blinking is no longer occurring. It may have been fixed in iOS 13.4 as Zifigo noted.

Same thing happens to me. From iOS13.2, adding an overlay (any kind, like tileoverlay, polyline) will cause all overlays refreshed, flickering.

So, I add all overlays to map, and change renderer's alpha to hide/show them, kind of temporary solution.