我在他们的站点中将 SQLCipher 配置为教程...我可以编译并运行该项目。但是 sqlite3_exec 在尝试执行语句时返回 SQLITE_NOTADB。
请在下面找到代码片段:
==================
NSString *dbPath = [self getDBPath];
BOOL success = [fileManager fileExistsAtPath:dbPath];
if(success) {
int sql_results = sqlite3_open([dbPath UTF8String], &SQLDB);
const char* key = [@"BIGSecret" UTF8String];
sqlite3_key(SQLDB, key, strlen(key));
if (sql_results == SQLITE_OK) {
NSString *sql;
const char *update_sql;
sql = [NSString stringWithFormat:@"DROP table %@",tablename];
update_sql = [sql cStringUsingEncoding:NSUTF8StringEncoding];
if(sqlite3_exec(SQLDB, update_sql, nil, nil, nil) == SQLITE_OK) {
NSLog(@"Good to go %@ dropped",tablename);
}
else {
NSLog(@"Bad Delete Cat SQL: %s -- %d", update_sql,sql_results);
NSLog(@"error code %i", sql_results);
}
我无法解决问题,我哪里出错了......
谢谢,
本