Loading a Database in iOS

I’m porting a project, which I originally created as a desktop app, to iOS.

The desktop app uses an external SQLite db. The first time you use the app you are prompted to identify several csv files which are used to load tables in the DB. During subsequent uses of the app, it checks on startup for the existence of the db and if it’s there then you proceed to use the app in a normal fashion wherein calls are made to the db for reference info, some new tables are created and manipulated dynamically etc. The data which is loaded into the db from the csv files is considered the reference info and doesn’t change while the db is in use, but could be updated at some future date. When that happens, the user trashes the db and then the next time the app is launched, the user is prompted again to identify those csv files (now new ones) in order to rebuild the db.

I’m telling you all this background as a way of asking how to get this csv information into an iOS sqllite db? My first thought was to just embed the INSERTS within the app, which works for troubleshooting, but is impractical for a built app. The three reference tables contain 13,000+ and 8,000+ and 100 rows respectively. The SQLite db, when fully loaded, only costs about 900kb so it’s not that big, storage-wise.

I’m OK at this point with building the db locally and including it with the iOS app, but where do you put it so that the app can read it?

I’m not sure what the path forward is at this point… any pointers?

Ios use the folder Documents for storing,etc

Dim docFile As FolderItem docFile = SpecialFolder.Documents

You’re likely to want to use a Copy File Build Step to copy something to the device. Refer to this page:
Copying Files to the Device

You can choose to copy your CSV files to the device and then run through them to build the DB like you do on the desktop. Or you can pre-build the DB and copy that to the device.

Loannis, thank you for getting me headed in the right direction, that worked in the short term.

Paul, the link you provided is what I was missing for the long term. Excellent documentation once you find it. Thanks a bunch.