Map view is blank after the app is in the background for a long time.
Environment
- Xcode version: 15.1
- iOS version: 17.2.1, 15.2
- Devices affected: iPhone 13 promax, iPhone 7 plus
- Maps SDK Version: 11.1.0
Observed behavior and steps to reproduce
- Create an app with MapView, configure MBXAccessToken key in project's Info.plist with valid a access token
- Open the app, the map is loaded successfully
- Put the app in the background, lock the screen
- After 1 or 2 days, reopen the app in the foreground, the map is blank
- Put the app in the background and then reopen it, the map is still blank
- Close the app, delete it from memory and then reopen it, the map is loaded successfully again
Expected behavior
- The map should not be blank after the app is in the background for a long time.
Notes / preliminary analysis
- Tried the Example Apps (https://github.com/mapbox/mapbox-maps-ios/tree/main/Apps) and the same issue occurs.
- Checked my access token with the link in https://docs.mapbox.com/help/troubleshooting/blank-tiles and it's still valid
Additional links and references
Map blank after the app in background:
The issue also occurs with the Example App:
https://github.com/mapbox/mapbox-maps-ios/assets/153174406/f326119e-47b6-47df-b31a-cb689fdc7d47
@longdike1 Hi, thank you for the report.
When the map turns black, do only the map tiles disappear, or does the content that you add onto the map disappear too? In the first screenshot, I see that you have a blue marker. Did you add it as an annotation or layer? Is it draggable when the map is black?
Hi @persidskiy, thanks for replying,
When the map turns black, only the map tiles disappear, the content that I add onto the map still appears. It is draggable when the map is black. In the first screenshot, I added a marker as a PointAnnotation:
pointAnnotationManager = mapView.annotations.makePointAnnotationManager(id: "pointAnnotationId")
...
var pointAnnotation = PointAnnotation(id: annotationItem.id, coordinate: annotationItem.coordinates)
pointAnnotation.iconImage = annotationItem.image
pointAnnotation.iconAnchor = .bottom
pointAnnotationManager.annotations.append(pointAnnotation)
We previously used Mapbox-iOS-SDK v6.4.1 and did not see this issue. Please let me know if you need more information.
@longdike1 Thank you for providing more details about this! Just want to confirm this - does this issue reproduce in debug mode(connected to debugger)? Could you provide logs as well?
I've created an internal ticket to track this issue https://mapbox.atlassian.net/browse/MAPSIOS-1326
@longdike1 Thank you for providing more details about this! Just want to confirm this - does this issue reproduce in debug mode(connected to debugger)? Could you provide logs as well?
I haven't tried reproducing this issue in debug mode because it takes 1 or 2 days. When the map is empty, I try connecting it to the debugger, the application restarts and the map works again
I have implemented onMapLoadingError observer but it doesn't print any log when the map is blank:
mapboxMap.onMapLoadingError.observe { event in
Logger.log(message: "mapboxMap.onMapLoadingError: \(event.message)")
}.store(in: &cancelables)
@evil159 any update on this one?
We're experiencing the same behaviour after upgrading to Mapbox 11.2.0, also using Xcode 15.1.
Before we were using 10.15.0 and everything was working perfectly fine.
@jimmya At the moment we cannot reproduce the issue.
We suspect tile store to be causing this, as a workaround you can disable tile store:
MapboxMapsOptions.tileStoreUsageMode = .disabled
It should not affect anything, unless you are using offline functionality.
@evil159 this temporary fix indeed looks to resolve the issue for us.
Can you please let us know when the issue is fixed and released so we can remove this workaround?
Thanks!
Sure thing @jimmya, we'll keep you posted.
We suspect tile store to be causing this, as a workaround you can disable tile store:
MapboxMapsOptions.tileStoreUsageMode = .disabledIt should not affect anything, unless you are using offline functionality.
Unfortunately we are using offline functionality.. Hopefully this issue will be fixed and released soon.
Same here. Offline functionality is important to us. Any updates?
We are also seeing this issue on mapbox 11.3.0 — hard to reproduce but the initial bug report is accurate: after prolonged app usage or leaving the app open for a day and then resuming
We are also experiencing the same issue with 11.3.0 in our testflight builds. The issue is also reproducible with the Snapshotter.
@evil159 any updates? Any ways we could help with collecting logs?
Here is the full log of the testing period 2024-05-24T13:00:34Z .. 2024-05-28T08:14:11Z. There is something different at 2024-05-27T04:33:24Z. I checked the phone at 2024-05-27T06:48:00Z and the opened map was displaying tiles. I checked again around 2024-05-28T07:56:24Z and then no more tiles, just black.
Same here, happening on iPad devices. Any updates?
+1 - we are seeing this in our production application as well. We utilize offline data so disabling that is not an option for us.
Very interesting find @.***
On Thu, Jun 13, 2024, 11:49 AM Richard Pineo @.***> wrote:
+1 - we are seeing this in our production application as well. We utilize offline data so disabling that is not an option for us.
— Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-maps-ios/issues/2123#issuecomment-2166064345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONVLUOGY2SWSD2CTJSGO4TZHG5O3AVCNFSM6AAAAABDOY3UV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRWGA3DIMZUGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@evil159 @maios @persidskiy
any updates?
We have introduced some threading related changes in 11.5 that may help with this problem. It's hard for us to confirm because for whatever reason we are unable to reproduce the issue ourselves, if someone who can reproduce consistently could try with 11.5 (or later) and report back that would be extremely helpful, thank you!
I can confirm this issue is still occurring in 11.5.
One note is it only occurs on tiles served from Mapbox - most notably satellite-raster and topography maps. The tiles from our in-house tile server are fine.
Also, if the user zooms all the way out, the tiles will eventually appear and they can use the map as normal again. We use offline maps so we haven't tried the work-around.