Article directory
1. Clone and download SQLCipher
$ cd ~/Documents/code
$ git clone https://github.com/sqlcipher/sqlcipher.git
2. Manual import
1. Generate sqlite3.c
Open the downloaded SQLCipher and run the script command
$ cd sqlcipher
$ ./configure --with-crypto-lib=none
$ make sqlite3.c
Import sqlite3.c
and sqlite3.h
into the project
2. Add commands to the project
- Add the following command under "Other C Flags." in the build setting:
-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=3 -DSQLCIPHER_CRYPTO_CC -DNDEBUG
.
- If it is a swift project, add it under the Release settings of "Preprocessor Macros"
SQLITE_HAS_CODEC=1
3. Added Security.framework
Add Security.framework in Link Binary With Libraries
Three, CocoaPods import
Podfile file add the following content
platform :ios, '10.0'
target 'SQLCipherApp' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'SQLCipher', '~>4.0'
end