My users are still reporting this bug, and more frequently, so I did a bunch more testing to see what I can find. I am now able to reproduce the issue a little more reliably. Since I still haven't heard any responses to the Feedback & TSI tickets, I feel like this is the only place to try finding anything.
To test the issue, I run the app from Xcode on my iPhone. The iPhone has Airplane Mode on, and Network Link Conditioner (Developer Settings) enabled with 100% loss. I pan and zoom around the map until the overlays disappear -- annotations are unaffected. This seems related to the MapView's cache of Apple Maps running out and at a specific location on the map, because if I find the exact spot where the overlays disappear, I can pan/zoom just a tiny bit back to where I was before, and the overlays reappear. Pan/zoom back to where they disappeared, and they disappear again. I can do this over and over, and it even persists between app launches as long as I keep Airplane Mode and Network Link Conditioner enabled (the app persists the visible map rect between launches as well). When the overlays disappear, it always happens exactly when the Apple Maps disappear and are replaced with the empty grid.
Some more things I tested or observed:
- At the moment the overlays disappear, I get a stream of logs like this (which I gather are sent by MapKit because the Apple Maps cache and network requests are failing):
[ResourceLoading] TiledGEOResourceFetcher received failed Resource: 623.735.11.255 t:27 kt:0, 334
[ResourceLoading] Failed to load key: 623.735.11.255 t:27 kt:0 type: 27, -1009: NSURLErrorDomain
- Added log statements at the beginning of the custom
MKTileOverlay
's loadTile(at:)
function, and found that as soon as the overlays disappear, no function calls are sent. When the overlays reappear, the function calls resume as before. - Likewise, added log statements to the beginning of the custom
MKPolylineRenderer
's draw(_:zoomScale:in:)
. As soon as the overlays disappeared, the function stopped being called. When they reappeared, the calls resumed as before. - I tried replacing the custom
MKPolylineRenderer
s with MapKit's standard MKPolylineRenderer
, with no effect. - I removed all calls to
overlay.setNeedsDisplay()
and related functions, also no effect. - Added a button to the MapView that causes all overlay renderers in the MapView to call
setNeedsDisplay()
. No effect there either. - Changed the button to instead remove all overlays and re-add them to the MapView. Still no effect.
- Tried not adding any of the
MKPolyline
s in the first place. The MKTileOverlay
still disappeared/reappeared during the pan/zoom. - Tried re-adding the
MKPolyline
s and not adding the MKTileOverlay
. The MKPolyline
s still disappeared/reappeared during pan/zoom.
I'm pretty much at my wits end with this. Anyone else have any ideas?