Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Help: loaded the nib but the view outlet was not set

I have a class called TaskListViewController and I am going to ShowTaskViewController. In the beginning in ShowTaskViewController I didn't have a view object I only Had a TableView object where I was dynamically loading data from a database and it worked fine.

Now I deleted the TableView object in ShowTaskViewController class and I dragged and dropped a View object in the .xib file and also dragged and dropped a TableView object on top of it because I want to have some additional buttons in that class, but now its showing me this error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ShowTaskViewController" nib but the view outlet was not set.'

Also this is the code I used to go to the ShowTaskViewController class before when it worked fine, now please help me to make the changes so the TableView object loads data properly.

-(IBAction)showAllTasks:(id)sender
{
    ShowTaskViewController *showTaskViewController = [[ShowTaskViewController alloc] initWithNibName:@"ShowTaskViewController" bundle:nil];

    [self presentModalViewController:showTaskViewController animated:YES];
}
like image 587
Shahnawaz Avatar asked Jul 25 '12 07:07

Shahnawaz


1 Answers

This is because in you xib your haven't set your view outlet.

Open you xib file select File Owner right click it and map your view outlet to your UIView in the xib.

For more detail plz check following links:

Loaded nib but the view outlet was not set - new to InterfaceBuilder

Error in Xcode "the view outlet was not set.'"

Hope this helps :)

like image 134
Kapil Choubisa Avatar answered Sep 19 '22 00:09

Kapil Choubisa