Add SQLCipher to the project

SQLCipher official address

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.cand sqlite3.hinto the project
insert image description here

2. Add commands to the project

  1. Add the following command under "Other C Flags." in the build setting:
    -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=3 -DSQLCIPHER_CRYPTO_CC -DNDEBUG.

insert image description here

  1. If it is a swift project, add it under the Release settings of "Preprocessor Macros"SQLITE_HAS_CODEC=1
    insert image description here

3. Added Security.framework

Add Security.framework in Link Binary With Libraries

insert image description here

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

Guess you like

Origin blog.csdn.net/guoxulieying/article/details/132208937