-(id)select:(NSString *)original_query
{
sqlite3_stmt *statement;
const char * converted = [original_query UTF8String];
NSLog(@"[INFO] converted char = %@", converted);
if (sqlite3_prepare_v2(db, converted, -1, &statement, NULL) != SQLITE_OK) {
@throw [NSException exceptionWithName: @"DB Encriptor" reason: [NSString stringWithFormat: @"Query \"%s\" has failed, we could not execute the SQL statement. '%s'", converted, sqlite3_errmsg(db) ] userInfo: nil];
}
else {
@try {
...
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
return NULL;
}
}
}
当执行到达行时:
const char * converted = [original_query UTF8String];
我收到以下错误:
2013-06-27 02:17:33.505 proof[25200:3c03] -[__NSArrayM UTF8String]: unrecognized selector sent to instance 0xc954a30
这可能是一个非常简单和愚蠢的错误,如果有人能给我一些指导,我会很感激,我花了好几个小时尝试不同的模式将字符串转换为UTF8但到目前为止没有成功。
谢谢!
修改 更多信息:我正在创建一个本机iOS模块,以便与Titanium一起工作。我从JavaScript(在Titanium中)调用此方法传递一个字符串,如:
encriptmydb.select("SELECT count(*) FROM sqlite_master;")
但错误仍然存在......