Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Storyboard - Navigation Controller Not Working
    primarykey
    data
    text
    <p>I am having trouble with a Navigation Controller in my iOS project which uses Storyboards.</p> <p>The main part of the project is a UITabBar. When the app loads for the very first time the screen RegisterViewController is presented:</p> <p><img src="https://i.stack.imgur.com/JPxcP.png" alt="Register View Controller"></p> <p>When the user taps on the "Register" button a HTTP POST request is made, then upon receiving the response (JSON object) the screen QuestionnaireViewController is presented using:</p> <pre><code>UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; QuestionnaireViewController *questionnaireViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"QuestionnaireView"]; [questionnaireViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; [questionnaireViewController setQuestionsAndAnswers:_questionsAndAnswers]; [self presentViewController:questionnaireViewController animated:NO completion:nil]; </code></pre> <p><img src="https://i.stack.imgur.com/NqDsj.png" alt="Questionnaire View Controller"></p> <p>When the user taps on a cell in QuestionnaireViewController a message is sent to prepareForSegue:sender:</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { UINavigationController *navigationController = segue.destinationViewController; AnswersViewController *answersViewController = [[navigationController viewControllers] objectAtIndex:0]; NSIndexPath *indexPath = [self.tableView indexPathForCell:sender]; NSArray *answers = [[_questionsAndAnswers objectAtIndex:indexPath.row] objectForKey:@"answers"]; [answersViewController setAnswers:answers]; } </code></pre> <p>At this point the app crashes with an error of: -[AnswersViewController viewControllers]: unrecognized selector sent to instance.</p> <p>Below is a more comprehensive overview of my storyboard, which may help in understanding where I have gone wrong:</p> <p><img src="https://i.stack.imgur.com/A3Yda.png" alt="Storyboard"></p> <p>I am stumped as to how to fix this, and am hoping that someone out there is able to help.</p> <p>Thanks, Nick</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload