iOS Question Database location

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I have been reading the tutorial: https://www.b4x.com/android/forum/threads/files-and-folders.46137/

I am planning on storing a local database (.db file) on the device and don't want the user to access this database in iTunes.

I also plan to add a log file (.txt file) so the user can access this file in iTunes.

Looking at the tutorial it says: File.DirDocuments can be shared through iTunes.

In order to enable this feature you need to add this attribute:
Code:
B4X:
#PlistExtra: <key>UIFileSharingEnabled</key><true/>

Since I want the log file to be accessible, I guess this file needs to be placed in File.DirDocuments.

However, where should I save my database file? I don't want this database to be deleted when the app gets updated. I am guessing this database needs to be placed in File.DirLibrary ?
 

David Martinez

Member
Licensed User
Longtime User
I just read this iOS Data Storage Guideline. After the user stores a lot of data in their database, that new data is cannot be reproduced by code and is very important to them. A backup would be great. I believe it should be stored in Documents. Please clarify.

  1. Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud.
  2. Data that can be downloaded again or regenerated should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.

Edit: I did see that the developer above did not want the user to access the DB. I don't mind if they do.
 
Last edited:
Upvote 0
Top