Hello,
I try to download a .sqlite File from my Dropbox.
So far this works and I save it to the documents directory.
I'm also able to establish a connection to the database but when I try to execute a query I get the error message:
"file is encrypted or is not a database"
this is the same database I used before as a local database in my app (I added the file manually to the project) and there it worked.
So the file can't be encrypted.
Also the query statements stayed the same.
Do I have to add some sort of description to the file?
Here is my code for downloading the file:
let fileManager = FileManager.default
let directoryURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
let destURL = directoryURL.appendingPathComponent("myTestFile.sqlite")
let destination: (URL, HTTPURLResponse) -> URL = { temporaryURL, response in
return destURL
}
client.files.download(path: path, overwrite: true, destination: destination)
.response { response, error in
if let response = response {
print(response)
self.downloadFinished(url: response.1)
} else if let error = error {
print(error)
}
}
.progress { progressData in
print(progressData)
}
}