I have installed SQLCipher via pod. but I am getting this error saying No such function: sqlcipher_export. I was using FMDB and for SQLCipher I am using the subspec of it i.e. FMDB/sqlcipher. I have added #import <SQLCipher/sqlite3.h> on top
below is my code:
It sounds as if your project is not correctly including SQLCipher, or that you may have another dependency that is overriding SQLCipher, causing your application to link against another version of SQLite. You can check if your application is linking against SQLCipher by querying the library for the cipher version, this will only be reported by SQLCipher. Please execute the following command and share the results:
Alternatively you can re-work the attach to just drop in the path inline so you can call executeStatement instead:
let attach = "ATTACH DATABASE '\(decryptedDbPath)' AS decrypted KEY ''"
...
let success = database.executeStatements(attach)
print("success of attach: \(success)")
@Ajeet_Maurya
I am facing the same issue if anyone can help me out. I am using same Objective C.
SQLCipher Version : 4.5.2
FMDB : 2.7.5
I do have previous database I want to encrypt previous as well as new data.
Thank you
Also I have installed with CocoaPods So, how can I check from my Build Setting is correctly installed because I can’t see anything on Other Linker Flags or Other CFlags.
The result from PRAGMA cipher_version in DB Browser for SQLite confirms that SQLCipher is properly linked within that program, but is completely unrelated to whether it is properly linked in your own program.
Because the sample code to check the cipher_version in your own program isn’t returning any results, this indicates the SQLCipher isn’t properly linked.
Also I have installed with CocoaPods So, how can I check from my Build Setting is correctly installed because I can’t see anything on Other Linker Flags or Other CFlags.
When installed via CocoaPods the appropriate Other C Flags and Other Linker Flags should be set automatically for you (on the target not on the project). You should double check that the Other C Flags and Other Linkers flags on your target to confirm that they are indeed properly automatically set.
If they are set but you’re still not getting a value from PRAGMA cipher_version then it’s possible you may have another dependency on sqlite within your project which is causing a conflict.
To determine this, I’d recommend reviewing all of your dependencies/pods (you can see what libraries are linked using the Podspec of each dependency) and determine where the other dependency on SQLite could be coming from. Another option is to create a new project, add the FMDB/SQLCipher pod, run the test code to confirm a correct cipher_version is produced, then add each of your additional dependencies in one by one until you run into a situation where PRAGMA cipher_version no longer produces a value which should narrow down where the additional SQLite dependency is coming from.