0

I have three methods which are taking parameters,

I am taking exception at this parameter giving,

[QuestionnaireView continueSingle:withQuestion:question:]: unrecognized selector sent to instance 0x8a4b1c0

What am i doing wrong? Its definition is also given in the header file.

Here is my code;

-(void) continueSingle:(id)sender withQuestion:(Question*)quest{

int counter = 0;

NSString * tempAnswer;

for(UIView* subview in [sender superview].subviews)
{

    if([subview isKindOfClass:[UIButton class]])
    {
        if([((UIButton*)subview) isSelected])
        {
            counter++;

            tempAnswer = [NSString stringWithFormat:@"%@",((UIButton*)subview).currentTitle];
        }
    }
}

}
erdemgc
  • 1,701
  • 3
  • 23
  • 43
  • Possible duplicate of [How can I debug 'unrecognized selector sent to instance' error](https://stackoverflow.com/questions/25853947/how-can-i-debug-unrecognized-selector-sent-to-instance-error) – Cœur Jul 08 '19 at 15:22

1 Answers1

1

Your mistake is here

-(void) continueSingle:(id)sender withQuestion:(Question*)quest

Because you are passing three parameter but you're receiving only two parameter. So you need to take 3 parameter. Like this..

-(void) continueSingle:(id)sender withQuestion:(Question*)quest question:(Question *)question1
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66