添加SQLCipher 到项目中

SQLCipher官方地址

一、克隆下载SQLCipher

$ cd ~/Documents/code
$ git clone https://github.com/sqlcipher/sqlcipher.git

二、手动导入

1. 生成sqlite3.c

打开下载的SQLCipher,运行脚本命令

$ cd sqlcipher
$ ./configure --with-crypto-lib=none
$ make sqlite3.c

sqlite3.csqlite3.h 导入到项目中
在这里插入图片描述

2. 在项目中添加命令

  1. 在build setting 中 “Other C Flags.” 下添加如下命令:
    -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=3 -DSQLCIPHER_CRYPTO_CC -DNDEBUG.

在这里插入图片描述

  1. 如果是swift项目添加"Preprocessor Macros"的 Release settings 下添加 SQLITE_HAS_CODEC=1
    在这里插入图片描述

3. 添加 Security.framework

在Link Binary With Libraries添加 Security.framework

在这里插入图片描述

三、CocoaPods导入

Podfile 文件添加下列内容

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

猜你喜欢

转载自blog.csdn.net/guoxulieying/article/details/132208937
今日推荐