NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
NSString *aImageUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
NSString *aCount = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)];
Animal *animal = [[Animal alloc] initWithName:aName description:aDescription url:aImageUrl countc:aCount ];
在“* aCcount”设置的行中编程收到信号“SIGABRT”,如何调试(求解)此类错误?
答案 0 :(得分:1)
似乎数据库列的值为null。在处理sqlite时,你需要首先检查null。
做这样的事情 -
if ((char *)sqlite3_column_text(compiledStatement, 4))
{
NSString *aCount = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)];
}
答案 1 :(得分:1)
该异常有一些可能性,请查看以下内容......
答案 2 :(得分:0)
打印nsstrings并检查initwithname函数