Large FMDatabase - iOS Deployment Question

51 views
Skip to first unread message

Steve Cronin

unread,
Jul 29, 2020, 12:54:35 AM7/29/20
to FMDB
Folks;

Using FMDatabase 2.7 in Xcode 11.6; Swift; iOS.

The database functionality is fine.  I'm looking for guidance on deployment.

I have a ~220M .sqlite file.

I have successful implemented this by building up the file using the Simulator- importing data using various .txt source files.
I then obtain the .sqlite file from the macOS file system and include it in the iOS application Resources.

On a clean install on a iPhone device I copy this .sqlite file to the .applicationSupportDirectory and use it from that location.
The database will change with usage, so I believe I cannot use the file from inside the iOS mainBundle,

This is all working as expected.
But I do not like the fact that I have used so much of the users storage (essentially 2x)
I do not want to remove the original file inside the mainBundle to support a re-install if that should become necessary...

I have tried to use Swift try SQLData.compressed(using: .lz4).
This suceeeds and I can similar obtain this compressed file from the macOS file system and include it within the app resources.

However I have not been successful decompressing this file"
              let compressURL:URL = URL.init(fileURLWithPath: Bundle.main.path(forResource: "compressedSQL", ofType: "lz4")!)

SQLData = NSData.init(contentsOf: compressURL)

do {

let compressedData = try SQLData.decompressed(using: .lz4)
                ...
                }


the above code never returns - it will run for hours...
Is there a known issue here?  Is there a better strategy?

I really would like to understand the best practice for deploying a large .sqlite file without using 2x the storage...

Any feedback is appreciated.

Steve
Reply all
Reply to author
Forward
0 new messages