Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[MGLOfflinePack suspend] does nothing #5531

Closed

Description

@madsodgaard

Platform: iOS
Mapbox SDK version: 3.2.3

Steps to trigger behavior

  1. Start downloading a offlinepack and set it to a global variable
  2. Try to call [MGLOfflinePack suspend] on the object

Expected behavior

It stops the download

Actual behavior

It continues downloading:

http://pastebin.com/9tiFKnFz

Extra

Is there no way to restrict the area which the user is allowed to navigate around? Since when you use offline maps, and the user goes out of the area, it just crashes det app.

Activity

  1. 1ec5 commented on Jul 1, 2016

    @1ec5
    Contributor

    suspend is asynchronous, and one reason the pack would proceed to completion might be that the resources required by the pack are already in another pack or the ambient cache (as a result of viewing the region on the map. What shouldn't happen is additional requests to the server after you suspend the pack. If you monitor the network activity gauge in Xcode, do you see continued network activity after suspending?

    Is there no way to restrict the area which the user is allowed to navigate around?

    Currently you'd need to implement -[MGLMapViewDelegate mapViewRegionIsChanging:] and -[MGLMapView mapView:regionDidChangeAnimated:] to reset the center coordinate if it's out of the desired bounds. #2457 would make this much easier.

    Since when you use offline maps, and the user goes out of the area, it just crashes det app.

    I'm unaware of such a crash. Can you file a separate bug with the stack trace so we can diagnose and address that issue? Thanks!

  2. madsodgaard commented on Jul 4, 2016

    @madsodgaard
    Author

    The problem is that my code uses an UIViewController to display the progress, If I cancel the pack and go back and try to download a new pack, it has to wait for that pack to be finished or else the UI will not fit the correct pack. I've tried fixing this with removePack, but that just crashes with "cannot change update progress of an invalid pack"

  3. 1ec5 commented on Jul 5, 2016

    @1ec5
    Contributor

    Would it be possible for you to remove the pack from your UI as soon as you try to cancel it, regardless of whether it’s still going? The SDK supports simultaneous downloads, so the next pack should start going even if the previous one doesn’t appear to be stopping yet.

  4. madsodgaard commented on Jul 5, 2016

    @madsodgaard
    Author

    Thats the problem, it still calls the didChangeProgress etc, with the old pack. Meaning my UI not being sync with the correct pack, and actually showing progress from the pack I cancelled

  5. 1ec5 commented on Jul 5, 2016

    @1ec5
    Contributor

    As a workaround until #5538 is implemented, perhaps your view controller could keep track of which packs it has already attempted to suspend and ignore those updates.

  6. madsodgaard commented on Jul 6, 2016

    @madsodgaard
    Author

    Yes, the problem with that. Is that when I suspend it keeps running the progressdidchange. Mening if I dismiss the viewcontroller and load it again with the new pack. It just continues the old one that should be suspended

  7. 1ec5 commented on Jul 6, 2016

    @1ec5
    Contributor

    OK, let's track the fix in #5538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions