Error: No such function: sqlcipher_export on iOS
Error: No such function: sqlcipher_export on iOS
我已经通过 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 文件时它工作正常。
我已经通过 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 文件时它工作正常。