Firebase-ios-sdk: New Location for the LevelDB directory

Created on 23 Feb 2018  路  9Comments  路  Source: firebase/firebase-ios-sdk

  • Xcode version: 9.2 (9C40b)
  • Firebase SDK version: 4.0.15
  • Firebase Component: Firestore
  • Component version: 0.10.1

Describe the problem

Firestore is currently storing the LevelDB files under the Documents/ directory on iOS. The Documents/ directory is visible to the end user (i.e in the Files app) and this could cause issues if an user inadvertently delete or rename a file belonging to Firestore/LevelDB.

Steps to reproduce:

  1. Create a basic iOS project with Firebase and Firestore
  2. Add the LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled to the project info.plist
  3. Run the project in Simulator
  4. Cmnd+H and open the Files app
  5. A folder named after the App should be present under 'On my iPhone'.
  6. If a filter is not visible, go to Photos app, chose an image and hit the 'Share' button. Swipe until 'Save on Files' is visible and chose it. The new folder should appear there.

Proposed Change:

I propose we change the location for the LevelDB directory from Documents/ to Library/Application support. This location is more inline with the guidelines defined by Apple here

Relevant bits:

  • Put user data in Documents/. User data generally includes any files you might want to expose to the user鈥攁nything you might want the user to create, import, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files. Video and audio apps may even include files that the user has downloaded to watch or listen to later.
  • Put app-created support files in theLibrary/Application support/ directory. In general, this directory includes files that the app uses to run but that should remain hidden from the user. This directory can also include data files, configuration files, templates and modified versions of resources loaded from the app bundle.
  • Remember that files in Documents/ and Application Support/ are backed up by default. You can exclude files from the backup by calling -[NSURL setResourceValue:forKey:error:] using the NSURLIsExcludedFromBackupKey key. Any file that can be re-created or downloaded must be excluded from the backup. This is particularly important for large media files. If your application downloads video or audio files, make sure they are not included in the backup.
firestore

Most helpful comment

This will go out with the next release!

All 9 comments

This location is essentially based on where we did it in the RTDB and that location was chosen somewhat arbitrarily. This is user data, but agreed that it's not user data that's useful as individual files. Regardless of our philosophical position on it the end-user experience with LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled enabled is something we should fix.

We provide custom directory browsing within our app. Until the fix is rolled out, I will have to manually hide this directory to the user.

+1

@mathieugarcia can you share how you are hiding the directory? We tried setting NSURLIsHiddenKey but it鈥檚 still showing in Files app.

It would be great if this issue could be addressed. Our users make use of the Files app to transfer a lot of files in/out of the device/app. This folder causes confusion to some people and is at risk of being deleted by the user.

Definitely agree here. User's shouldn't be able to access this in the Documents directory which is meant for User generated files.

@wilhuff is on the roadmap?

For sure, though the fix is tricky when accounting for migrating existing data because we're not structured to handle that (yet).

@mathieugarcia how can I hide Firebase directory please?

This will go out with the next release!

Was this page helpful?
0 / 5 - 0 ratings