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

iOS, Android are not using the offline database #4362

Closed
jfirebaugh opened this issue Mar 17, 2016 · 11 comments
Closed

iOS, Android are not using the offline database #4362

jfirebaugh opened this issue Mar 17, 2016 · 11 comments
Assignees
Labels
Android Mapbox Maps SDK for Android iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline

Comments

@jfirebaugh
Copy link
Contributor

iOS creates an offline database named "offline.db", but then uses the name "cache.db" for the actual map view. These need to be the same name, if not the same instance of DefaultFileSource.

@jfirebaugh jfirebaugh added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline labels Mar 17, 2016
@jfirebaugh jfirebaugh added this to the ios-v3.2.0 milestone Mar 17, 2016
@jfirebaugh
Copy link
Contributor Author

It looks like the path, as well as the name, is different.

@1ec5 1ec5 added the Android Mapbox Maps SDK for Android label Mar 17, 2016
@1ec5
Copy link
Contributor

1ec5 commented Mar 17, 2016

I copied the Android SDK, which is doing the same thing: mbgl-cache.db, mbgl-offline.db.

/cc @zugaldia

@1ec5 1ec5 changed the title iOS is not using the offline database iOS, Android are not using the offline database Mar 17, 2016
@1ec5
Copy link
Contributor

1ec5 commented Mar 17, 2016

On iOS, per #4371, the unified cache definitely shouldn’t go in the Caches directory, where the ambient cache currently resides. If we put it in the Documents directory, where the offline cache currently resides, a .db file will be listed in iTunes as a shareable document for every Mapbox-powered application, which is a poor user experience. As a compromise, we can put the unified cache in Application Support, but there are two caveats:

  1. It isn’t possible for a user to export their offline cache to another device or import it from another device. For example, if a user installs both the iOS and OS X versions of an application, they can currently drag their OS X offline cache into iTunes, and the iOS application should automatically be able to make use of it.
  2. If disk space runs low on the iOS device, the unified cache will continue to eat up disk space, potentially due to ambiently cached content, and the only way to reclaim that space would be to delete the application (along with all the offline content).

@1ec5
Copy link
Contributor

1ec5 commented Mar 17, 2016

#4372 puts the OS X offline cache in a subfolder of Application Support, but neither caveat in #4362 (comment) applies to OS X.

@1ec5
Copy link
Contributor

1ec5 commented Mar 18, 2016

Per chat, on iOS, we’re going to place the offline cache in Application Support. If there’s an existing offline.db in Documents, we’ll move it; if there’s an existing caches.db in Caches, we’ll delete it.

@1ec5 1ec5 self-assigned this Mar 18, 2016
@NamtarR
Copy link

NamtarR commented Mar 18, 2016

In Android after complete download of a region and switching off network connection the map is not using downloaded data - it shows nothing after move or zoom change. Moreover, if I switch network connection and then launch the app it is trying to load style data (and that is the style the region has been downloaded with) from Mapbox servers and it crashes with no exception but

03-18 10:38:40.768 9236-9304/ru.aspirity.stolbyapp E/mbgl: {Map}[Setup]: loading style failed: Unable to resolve host "api.mapbox.com": No address associated with hostname
03-18 10:38:40.769 9236-9304/ru.aspirity.stolbyapp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 9304 (Map Thread)

It seems it is not using offline data at all.

@1ec5
Copy link
Contributor

1ec5 commented Mar 18, 2016

Fixed in the iOS and OS X SDKs in #4377.

@zugaldia
Copy link
Member

Android work is in #4383.

@1ec5
Copy link
Contributor

1ec5 commented Mar 18, 2016

Closing in favor of #4377 on iOS and OS X and #4383 on Android. Unifying the mbgl::DefaultFileSource on Android is tracked as tail work in #4386.

@1ec5 1ec5 closed this as completed Mar 18, 2016
zugaldia added a commit that referenced this issue Mar 18, 2016
…Manager, and change the name in JNI to match.
zugaldia added a commit that referenced this issue Mar 18, 2016
@1ec5
Copy link
Contributor

1ec5 commented Mar 18, 2016

@NamtarR, the fix is now in the v3.2.0-beta.2 of the iOS SDK. Please let us know if you continue to see this issue. Thanks!

@zugaldia
Copy link
Member

Android fixed this in #4383 and the fix will be available in the next SNAPSHOT.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline
Projects
None yet
Development

No branches or pull requests

4 participants