Closed
Description
- 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:
- Create a basic iOS project with Firebase and Firestore
- Add the LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled to the project info.plist
- Run the project in Simulator
- Cmnd+H and open the Files app
- A folder named after the App should be present under 'On my iPhone'.
- 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—anything 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 the
Library/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/
andApplication 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.