mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

'mapViewDidFinishLoadingMap' method is not called when app is in offline.

Open ThiyagarajanShivSankaran opened this issue 6 years ago • 20 comments

Steps to reproduce

  1. Create an app and download the offline packs.
  2. Open the app in offline mode.
  3. mapViewDidFinishLoadingMap delegate method is not getting called.

Expected behavior

  1. mapViewDidFinishLoadingMap method should be called when map view finishes loading.

Actual behavior

  1. But, it's not.

Configuration

Mapbox SDK versions: 4.7.0 iOS/macOS versions: 12.1 Device/simulator models: all Xcode version: 10.1

Hello, Did this issue is even considered or not?

On Android this callback/delegate is correctly called. Can someone from @mapbox/maps-ios look into reproducing this issue?

tobrun avatar Mar 06 '19 10:03 tobrun

@ThiyagarajanShivSankaran thanks for your patience, we are currently investigating this issue and believe we have re-created your scenario.

julianrex avatar Mar 06 '19 18:03 julianrex

Experiencing the same behaviour.

alexbtlv avatar Mar 13 '19 06:03 alexbtlv

After some more testing, I was also able to reproduce on android. The callback delegate isn't called when your initial camera position doesn't fully cover the bounds of the offline region (or even slightly more). This makes sense to some degree as tiles in the vicinity aren't fully loaded thus we aren't emitting the fully loaded event neither.

cc @tmpsantos

tobrun avatar Mar 13 '19 09:03 tobrun

@tobrun do you get a onDidBecomeIdle in this case?

tmpsantos avatar Mar 13 '19 14:03 tmpsantos

Same issue, workaround to solve?

ghost avatar Mar 29 '19 08:03 ghost

@tmpsantos I don't think there's anything for iOS/Android to do here, can core take a look?

julianrex avatar Apr 08 '19 21:04 julianrex

@tmpsantos I'm not getting those either, only when fully covering the region it emits idle/fully loaded

tobrun avatar Apr 09 '19 10:04 tobrun

@tmpsantos I don't think there's anything for iOS/Android to do here, can core take a look?

:+1:

tmpsantos avatar Apr 12 '19 13:04 tmpsantos

Can I know why it's taking so long to fix this issue.

@tmpsantos @pozdnyakov was there any action to take here?

julianrex avatar Sep 19 '19 04:09 julianrex

Hi Guys, @tmpsantos @pozdnyakov

Any updates for this issue? Seems there is no update for almost 3 months. We forced to use ugly workarounds due to this bug.

david-var avatar Dec 13 '19 07:12 david-var

Still have a that issue. Please fix

arthopar avatar Dec 13 '19 08:12 arthopar

Hi all, thanks for the feedback. We'll do our best to prioritise this issue. May I ask, what do you use mapViewDidFinishLoadingMap for in your implementation? I'm hoping to get a sense of your use case.

@arthopar @david-var @ThiyagarajanShivSankaran @mannycalavera27 @alexbtlv

chloekraw avatar Dec 14 '19 01:12 chloekraw

Hi all, thanks for fast reply. We are using mapViewDidFinishLoadingMap to access style and draw layers, because before of mapViewDidFinishLoadingMap the style is nil. We are going to support offline mode for our application, but in offline mode because of this issue, we are unable to determine when we can draw layers. We had done some workaround. we are waiting 1 second and then drawing the layer, but if you have other solution I will glad to know.

Regards, Artak

On Sat, Dec 14, 2019 at 5:58 AM Chloe Krawczyk [email protected] wrote:

Hi all, thanks for the feedback. We'll do our best to prioritise this issue. May I ask, what do you use mapViewDidFinishLoadingMap for in your implementation? I'm hoping to get a sense of your use case.

@arthopar https://github.com/arthopar @david-var https://github.com/david-var @ThiyagarajanShivSankaran https://github.com/ThiyagarajanShivSankaran @mannycalavera27 https://github.com/mannycalavera27 @alexbtlv https://github.com/alexbtlv

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-gl-native/issues/13867?email_source=notifications&email_token=ABGVBY7UO77TSQBKEWTD6BDQYQ4UJA5CNFSM4GUDAJZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3XCQQ#issuecomment-565670210, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGVBY4HUZBFGWHKURVFFTTQYQ4UJANCNFSM4GUDAJZA .

-- Regards, Artak Tsatinyan

arthopar avatar Dec 14 '19 08:12 arthopar

We are using mapViewDidFinishLoadingMap to access style and draw layers because before of mapViewDidFinishLoadingMap the style is nil.

@arthopar Have you tried using Android MapView.addOnDidFinishLoadingStyleListener or iOS mapViewDidFinishLoadingStyle? After that callback is invoked, style should not be nil.

alexshalamov avatar Dec 16 '19 10:12 alexshalamov

From https://github.com/mapbox/mapbox-gl-native/issues/13867#issuecomment-472335865

The callback delegate isn't called when your initial camera position doesn't fully cover the bounds of the offline region (or even slightly more). This makes sense to some degree as tiles in the vicinity aren't fully loaded thus we aren't emitting the fully loaded event neither.

I'm having the same results and to put it in a different way: I see that mapViewDidFinishLoadingMap is invoked if the camera fully covers the loaded region - it is expected behavior: mapViewDidFinishLoadingMap cannot be invoked until all the requested tiles are loaded i.e. if the engine has requested any tiles that are not present in the offline region.

My recommendation would be either using mapViewDidFinishLoadingStyle or making sure that the offline region contains all the tiles requested for the app work.

Another important thing might be turning off the tile pre-fetch (shall not be needed in pure offline mode), so that the engine does not request lower zoom level tiles.

pozdnyakov avatar Dec 16 '19 10:12 pozdnyakov

Alexander, thanks I guess we can use mapViewDidFinishLoadingStyle, but Is it secure to set camera in that stage, or download offline pack?

On Mon, Dec 16, 2019 at 2:56 PM Mikhail Pozdnyakov [email protected] wrote:

From #13867 (comment) https://github.com/mapbox/mapbox-gl-native/issues/13867#issuecomment-472335865

The callback delegate isn't called when your initial camera position doesn't fully cover the bounds of the offline region (or even slightly more). This makes sense to some degree as tiles in the vicinity aren't fully loaded thus we aren't emitting the fully loaded event neither.

I'm having the same results and to put it in a different way: I see that mapViewDidFinishLoadingMap is invoked if the camera fully covers the loaded region - it is expected behavior: mapViewDidFinishLoadingMap cannot be invoked until all the requested tiles are loaded i.e. if the engine has requested any tiles that are not present in the offline region.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-gl-native/issues/13867?email_source=notifications&email_token=ABGVBY4KRXAC67OIVQKZ35DQY5NHNA5CNFSM4GUDAJZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG6KIBQ#issuecomment-566010886, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGVBY6O3OG2MLNP76QWNETQY5NHNANCNFSM4GUDAJZA .

-- Regards, Artak Tsatinyan

arthopar avatar Dec 16 '19 11:12 arthopar

but Is it secure to set camera in that stage, or download offline pack?

Yeah, I do not think the engine is limiting this.

pozdnyakov avatar Dec 16 '19 12:12 pozdnyakov