ios - 错误:没有这样的功能:iOS 上的 sqlcipher_export
问题描述
我已经通过 pod 安装了 SQLCipher。但我收到此错误消息 No such function: sqlcipher_export。我使用的是 FMDB,而对于 SQLCipher,我使用的是它的子规范,即 FMDB/sqlcipher。我已经添加了
#import <SQLCipher/sqlite3.h>
下面是我的代码:
NSString *docsDir;
NSArray *dirPaths;
dirPaths = NSSearchPathForDirectoriesInDomains
(NSApplicationSupportDirectory, NSUserDomainMask, YES);
docsDir = dirPaths[0];
databasePath = [[NSString alloc] initWithString:[docsDir stringByAppendingPathComponent: @"MyDB.db"]];
NSString *encryptDB = [docsDir stringByAppendingPathComponent:@"MyDB_enc.db"];
const char* sqlQ = [[NSString stringWithFormat:@"ATTACH DATABASE '%@' AS MyDB_enc KEY 'test123';",encryptDB] UTF8String];
//sqlite3 *unencrypted_DB;
if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
// Attach empty encrypted database to unencrypted database
sqlite3_exec(database, sqlQ, NULL, NULL, NULL);
// export database
sqlite3_exec(database, "SELECT sqlcipher_export('MyDB_enc');", NULL, NULL, NULL); //gives error
// Detach encrypted database
sqlite3_exec(database, "DETACH DATABASE MyDB_enc;", NULL, NULL, NULL);
sqlite3_close(database);
}
else {
sqlite3_close(database);
NSAssert1(NO, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
}
databasePath = [docsDir stringByAppendingPathComponent:@"MyDB_enc.db"];
谁能指导我如何解决这个问题
解决方案
我在安装 POD 时遇到了这个问题,但是当我在编译二进制文件后使用 sqlite3.h 文件时,它工作正常。
推荐阅读
- c - 数独游戏:如何测试包含读取二进制文件的代码
- flask - JSONAPI:更新关系,包括属性
- javascript - GOJS,节点周围的甜甜圈图
- node.js - 在 node/express 中启用了 CORS,但得到“对预检请求的响应未通过访问控制检查”
- r - 从 R 中的传单或 ggmap 创建地理参考 png 文件
- html - 单击保存按钮时,单选按钮模型返回未定义的值
- node.js - nw.js,如何检测代码更改并刷新页面
- umbraco - 模板未保存 404 未找到 umbraco/RestServices/SaveFile/SaveTemplate UMBRACO
- javascript - 动画迭代的延迟
- elasticsearch - 弹性搜索查询其中值存在于 2 个字段值之间