0

Iam Using FMDb for inserting into sqlite database my code goes like this

in first view controller:

   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 DataBaseManager

[[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];

at the first time its executing fine but when again the function

[[DatabaseManager sharedDatabaseManager] insertDetails:emp] is  called from FirstViewController i get exception like this :

-[__NSCFString insertDetails:]: unrecognized selector sent to instance 0x71897a0 2013-02-22 14:49:59.926 ExamApp[3679:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString insertDetails:]: unrecognized selector sent to instance 0x71897a0' please help me

Naveen Pathiyil
  • 826
  • 1
  • 7
  • 8

1 Answers1

0

It looks like your

[DatabaseManager sharedDatabaseManager]

is returning the wrong Object. Please post this method in your Question.

NoilPaw
  • 714
  • 5
  • 11