简体   繁体   中英

iOS storing SQLite database

I'm working on an app for iPad that uses a SQLite database. I am fairly far along in the development and now I'm trying to solve a problem of how to configure the app so that the database when it is on the iPad can be seen in the Files app. I have this app that I use named "Accounts2" and in Files on the iPad I can see its database in its own folder.

So far I've added the key "Application supports iTunes file sharing" to my info.plist and I can see the file in iTunes and drag the file off to my local disk. Now I'd like to understand what changes I need to make to be able to see the database file in the Files app..

Also, in the app I've defined the location of the database as being at:

let databaseFolder = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String

Working with a breakpoint running the app on the iPad I see that the path above has translated to the following

/var/mobile/Containers/Data/Application/C3079EB8-2190-4161-A5E4-ABFFB3374393/Documents

so that is where my database is being placed.

I'm wondering if I need to change that location and where that might be... In files I see the folders like below and I'd like to see my app in there..

在此处输入图片说明

Thanks to DonMag's suggestion above I wound up adding the keys he suggested to my info.plist and the file now appears in the "Files.app". The keys I added all together were:

<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UISupportsDocumentBrowser</key>
<true/>

See ManagingYourMoney icon below:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM