SQLLite to iOSSQLte

I just create an Desktop App in Xojo to create and edit an SQLLite database. For now I want to create an iOS App with Xojo and put the SQLLite database file in the app.

How can I put the database file in the iOS project and access to it from the iOS app ?

Cheers
Sébastien

Add a copy files build step to the project to copy the database.
Place the files build step after build but before code-signing.

1 Like

Thank you @Jeremie_L

I copy the file as you say in app ressource then I use it like this to have read/write access in the app sandbox:

const dbFileName = "mydb.sqlite"

// Get. Ressource
Var source As Xojo.IO.FolderItem = xojo.io.SpecialFolder.GetResource(dbFileName)

// Copy to app sand box
If Not xojo.io.SpecialFolder.Documents.Child(dbFileName).Exists Then
  source.CopyTo(xojo.io.SpecialFolder.documents)
End If

Try 
  // Connect to Database
  Var db As New iOSSQLiteDatabase
  Var f As FolderItem = xojo.io.SpecialFolder.Documents
  db.DatabaseFile = f.Child(dbFileName)
If db.Connect Then
  // .....
End If
Catch e As RuntimeException
  MessageBox (e.Reason)
End Try