我使用 FMDb 插入 sqlite 数据库我的代码是这样的
在第一个视图控制器中:
emp.questions = question;
if ([finalArray count]==3) {
emp.option0 = [finalArray objectAtIndex:0];
emp.option1 = [finalArray objectAtIndex:1];
emp.option2 = [finalArray objectAtIndex:2];
emp.option3= @"no option";
emp.option4= @"no option";
emp.option5= @"no option";
}
if ([finalArray count]==4) {
emp.option0 = [finalArray objectAtIndex:0];
emp.option1 = [finalArray objectAtIndex:1];
emp.option2 = [finalArray objectAtIndex:2];
emp.option3 = [finalArray objectAtIndex:3];
emp.option4= @"no option";
emp.option5= @"no option";
}
if ([finalArray count]==5) {
emp.option0 = [finalArray objectAtIndex:0];
emp.option1 = [finalArray objectAtIndex:1];
emp.option2 = [finalArray objectAtIndex:2];
emp.option3 = [finalArray objectAtIndex:3];
emp.option4 = [finalArray objectAtIndex:4];
emp.option5= @"no option";
}
if ([finalArray count]==6) {
emp.option0 = [finalArray objectAtIndex:0];
emp.option1 = [finalArray objectAtIndex:1];
emp.option2 = [finalArray objectAtIndex:2];
emp.option3 = [finalArray objectAtIndex:3];
emp.option4 = [finalArray objectAtIndex:4];
emp.option5 = [finalArray objectAtIndex:5];
}
[[DatabaseManager sharedDatabaseManager] insertDetails:emp];
[finalArray removeAllObjects];
IN 数据库管理器
[[self database] executeUpdate:@"insert into questionstable(questions, option0,option1,option2,option3,option4,option5) values(?,?,?,?,?,?,?)",emp.questions,emp.option0,emp.option1,emp.option2,emp.option3,emp.option4,emp.option5];
第一次执行良好,但再次执行该功能
[[DatabaseManager sharedDatabaseManager] insertDetails:emp] is called from FirstViewController i get exception like this :
-[__NSCFString insertDetails:]:无法识别的选择器发送到实例 0x71897a0 2013-02-22 14:49:59.926 ExamApp[3679:c07] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[__NSCFString insertDetails:]:无法识别的选择器发送到实例 0x71897a0' 请帮助我