I have large database in sqlite file
so I am trying to access it directly from my data.sqlite file
but I am not able to access it . I had achieved that task in past using objective C
Steps Taken:
1:Drag data.sqlite file into project
2:Trying to access it via fmdb
Output: path=== /var/mobile/Containers/Data/Application/557B2961-52D8-4B14-BABC-BF4829852127/Documents/data.sqlite
let documentsDirectory = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as NSString) as String
pathToDatabase = documentsDirectory.appending("/(databaseFileName)")
func openDatabase() -> Bool {
print("path=== \(pathToDatabase ?? "empty")")
if database == nil {
if FileManager.default.fileExists(atPath: pathToDatabase) {
database = FMDatabase(path: pathToDatabase)
//code is not entering in that if , it should be there becasuse I already included my sqlitefile
}
if database != nil {
if database.open() {
return true
}
}
return false
}