mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

Map view is blank after the app is in the background for a long time.

Open longdike1 opened this issue 1 year ago • 21 comments

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: map_blank

The issue also occurs with the Example App: map_blank_ex

https://github.com/mapbox/mapbox-maps-ios/assets/153174406/f326119e-47b6-47df-b31a-cb689fdc7d47

longdike1 avatar Feb 19 '24 04:02 longdike1

@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?

persidskiy avatar Feb 19 '24 15:02 persidskiy

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 avatar Feb 20 '24 03:02 longdike1

@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?

evil159 avatar Feb 20 '24 08:02 evil159

I've created an internal ticket to track this issue https://mapbox.atlassian.net/browse/MAPSIOS-1326

evil159 avatar Feb 20 '24 08:02 evil159

@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)

longdike1 avatar Feb 20 '24 10:02 longdike1

@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 avatar Mar 12 '24 09:03 jimmya

@jimmya At the moment we cannot reproduce the issue.

evil159 avatar Mar 12 '24 09:03 evil159

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 avatar Mar 12 '24 09:03 evil159

@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!

jimmya avatar Mar 14 '24 08:03 jimmya

Sure thing @jimmya, we'll keep you posted.

evil159 avatar Mar 14 '24 08:03 evil159

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.

Unfortunately we are using offline functionality.. Hopefully this issue will be fixed and released soon.

longdike1 avatar Mar 18 '24 04:03 longdike1

Same here. Offline functionality is important to us. Any updates?

ittna avatar Apr 08 '24 12:04 ittna

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

brendanw avatar May 12 '24 15:05 brendanw

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?

ristiisa avatar May 23 '24 06:05 ristiisa

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.

mapbox-logs 2.txt

ristiisa avatar May 28 '24 10:05 ristiisa

Same here, happening on iPad devices. Any updates?

iMark21 avatar Jun 11 '24 09:06 iMark21

+1 - we are seeing this in our production application as well. We utilize offline data so disabling that is not an option for us.

richardpineo avatar Jun 13 '24 15:06 richardpineo

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: @.***>

Kingjames52-bot avatar Jun 13 '24 16:06 Kingjames52-bot

@evil159 @maios @persidskiy

any updates?

ristiisa avatar Jul 18 '24 14:07 ristiisa

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!

baleboy avatar Aug 12 '24 12:08 baleboy

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.

james-fresco avatar Sep 20 '24 12:09 james-fresco