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.

Storing offline.db in user caches directory bad idea on OS X #4371

Closed

Description

@postmechanical

The caches directory may get purged by the system at any time. It is not hard to imagine a case where a user is offline, depending on their offline map regions, and fills up their device in some other way (e.g., taking a lot of photos). In such a case the system could and would purge the user cache directory and remove the Mapbox SDK's offline db.

See:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *cachePath = [paths.firstObject stringByAppendingPathComponent:fileName];

Activity

  1. 1ec5 commented on Mar 17, 2016

    @1ec5
    Contributor

    The code linked above places the offline.db file inside the Documents directory, not the Caches directory. MGLMapView does place the cache.db file inside the Caches directory, but that file is used for ambient caching and can be regenerated cheaply.

    In #4362, @jfirebaugh pointed out that both files should be unified, which probably means the unified cache would go in the Documents directory. Unfortunately this means that an application that doesn’t use offline packs will nonetheless have a cache.db file hanging around in its documents list in iTunes. But we are currently avoiding using the Caches directory for offline downloads and will continue to avoid it for the reason you point out.

  2. added
    iOS
    on Mar 17, 2016
  3. 1ec5 commented on Mar 17, 2016

    @1ec5
    Contributor

    However, this code does store the offline cache in the Caches directory on OS X. Although OS X isn’t nearly as aggressive as iOS in purging the Caches directory, we should be putting the OS X offline cache in Application Support, not Caches.

  4. reopened this on Mar 17, 2016
  5. changed the title [-]Storing offline.db in user caches directory bad idea on iOS[/-] [+]Storing offline.db in user caches directory bad idea on OS X[/+] on Mar 17, 2016
  6. added
    macOS
    and removed
    iOS
    on Mar 17, 2016
  7. added a commit that references this issue on Mar 17, 2016
    6a6b575
  8. 1ec5 commented on Mar 18, 2016

    @1ec5
    Contributor

    Closing in favor of #4362.

  9. postmechanical commented on Mar 18, 2016

    @postmechanical
    Author

    @1ec5 Thanks! Sorry for misreading the linked lines of code. I saw the OS X lines and 💥.

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

    macOSoffline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions