Iphone NSString在钛模块中以NSMUTABLEARAY的形式出现

Iphone NSString在钛模块中以NSMUTABLEARAY的形式出现,iphone,sqlite,titanium,titanium-modules,Iphone,Sqlite,Titanium,Titanium Modules,当执行到达行时: -(id)select:(NSString *)original_query { sqlite3_stmt *statement; const char * converted = [original_query UTF8String]; NSLog(@"[INFO] converted char = %s", converted); if (sqlite3_prepare_v2(db, converted, -1, &stateme

当执行到达行时:

-(id)select:(NSString *)original_query
{
    sqlite3_stmt *statement;
    const char * converted = [original_query UTF8String];

    NSLog(@"[INFO] converted char = %s", 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];
这可能是一个非常简单和愚蠢的错误,我花了数小时尝试不同的模式将字符串甚至[NSMutableArray description]转换为UTF8,但迄今为止没有成功。 我正在创建一个本机iOS模块来与Tianium一起工作。我从JavaScript(在Tianium中)调用此方法,传递字符串,类似于:

 2013-06-27 02:17:33.505 proof[25200:3c03] -[__NSArrayM UTF8String]: unrecognized selector sent to instance 0xc954a30

但错误依然存在

请查看此处的示例模块指南

基本上,正在发生的事情是,参数作为数组传入,您只需提取第一个参数即可获得字符串参数

请参见此处的参数传递示例


这看起来与您前面的问题非常相似。也许可以添加
NSLog(@“%@”,原始查询)
来缩小问题的范围。是的,Martin,确实如此。但当我发现问题不同时,我决定打开另一个线程,看看是否还有其他想法。你建议的NSLog在屏幕上正常打印:(你能显示NSLog输出吗?我想我之前做过,但现在做不到了。当我尝试在屏幕上打印时,什么都没有发生。谢谢你,Aaron..这就是小故障。
 encriptmydb.select("SELECT count(*) FROM sqlite_master;")