0
votes

I am working in Xamarin Forms with an iOS app. The code downloaded successfully an sqlite file and I moved the file to the following location: /var/mobile/Containers/Data/Application/787D3CB8-01E1-41BB-B786-972534E7F563/Documents/Data/test-file.sqlite

but now when I try to open it with the following code I get a strange error: SQLite.SQLiteException: 'file is not a database'

The database is also not encrypted

here is my code:

var db = new SQLiteAsyncConnection(_dbPath);
var versionlist = await db.QueryAsync<version_history>("SELECT * FROM version_history ORDER BY id DESC LIMIT 1")
                           

after I do the QueryAsync I get the error, the file is not a database. but the db object does have the information enter image description here

Please help me, any ideas?

1
It has been some time but I found and fixed the problem. So here is the funny thing. It turned out it wasn't a real sqlite file after all. It was a zip file but named as a sqlite file and the more crazy is, the fact that it was readable by the sql lite lib. Even when it was a stil a zip file - Henkie85
Thanks for your sharing, please post your comment to answer, it will help others who have similar issue. - Leon Lu - MSFT

1 Answers

0
votes

It turned out it wasn't a real sqlite file after all. It was a zip file but named as a sqlite file and the more crazy is, the fact that it was readable by the sql lite lib, when using SQLiteAsyncConnection. Even when it was a zip file. But the moment you fire a query, you will get the error saying that it is not a database.