0

I'm encountering an issue with SQLCipher in my iOS app after updating to a new version, which involves different workspaces of my app. The app uses SQLCipher(version: 3.1) to manage an encrypted SQLite database.The previous version (workspace2) had SQLCipher code that worked correctly. However, after updating to the new version (workspace1), I'm now receiving the error "file is not a database" when trying to access the database file.

Workspace Dependencies:

Previous Version:

  • Workspace1: There is no db related code here
  • Workspace2: Contains SQLCipher integration code and database operations.
  • App: Dependent on Workspace1 & 2 which includes additional app logic and functionality.

New Version:

  • Workspace1: Contains SQLCipher integration code and database operations.

  • Workspace2: Depending on workspace1 and using few db operations.

  • App: Dependent on Workspace1 & 2 which includes additional app logic and functionality.

Steps Taken:

Checked Database Path:

  • Confirmed that the database file exists at the specified path in the Documents directory.

  • Ensured that the path is correct and the file is not missing.

Encryption Key:

  • Verified that the correct encryption key is used to open the database.

  • The encryption key hasn't changed between app versions.

Database File Integrity:

  • Considered the possibility of database file corruption after the update.

  • Not sure how to verify or fix any potential corruption.

8
  • This sounds like: an issue with the way you've integrated SQLCipher or mismatched SQLCipher major versions (you won't be able to open SQLCipher 3.x databases with SQLCipher 4.x by default as the encryption settings are different -- you'll need to use cipher_migrate or open it with compatibility settings: discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283). I'd recommend pulling the database off the device and attempting to open it with DB Browser for SQLite: sqlitebrowser.org If you're still stuck, create an simple example project on GitHub and post a link to it.
    – R4N
    Commented Jul 8 at 11:06
  • but here I am using 3.4 version only.
    – bAthi
    Commented Jul 8 at 12:12
  • In both workspace 1 and workspace 2 implementations? My initial guess without seeing your code would be that it's some sort of issue with the way you've integrated SQLCipher. As mentioned in my previous comment, you should pull the database off the device, download DB Browser for SQLite and attempt to open it with that. Then if you're still stuck create a minimal project that reproduces the issue, upload it to GitHub and then post a link to it.
    – R4N
    Commented Jul 8 at 12:15
  • In both workspaces used 3.4 version only.
    – bAthi
    Commented Jul 8 at 12:32
  • Did you pull the encrypted database off the device and attempt to open it with DB Browser for SQLite using SQLCipher 3 default encryption settings? What was the result?
    – R4N
    Commented Jul 8 at 13:22

0

Browse other questions tagged or ask your own question.