Answer the question
In order to leave comments, you need to log in
Connect sqlite file to Swift application?
Hello!
Can you please tell me how to correctly add my sqlite database file (already with data, not re-create) to the project/application? And how it will be necessary to address this file.
Working with the database itself - everything is OK, the essence is in accessing the file.
I 'm using the latest XCode, Swift 4.
If possible, please provide more details.
How I do now:
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
.appendingPathComponent("base.sqlite")
print("fileUIrl: ")
print(fileURL)
var db: OpaquePointer?
if sqlite3_open(fileURL.path, &db) != SQLITE_OK {
print("error opening database")
} else { print ("GOOD DATABASE") }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question