0

Can't solve this problem

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/A0EC53C5-E9C0-4191-9BAF-0B61205B92F0/Handbook.app> (loaded)' with name 'pAM-c5-AKQ-view-CuA-a0-uZt' and directory 'Storyboard.storyboardc''

I have a ListViewController: UITableViewController which pushes another DetailViewController:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"ShowDetailsSegue" sender:self];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"ShowDetailsSegue"])
    {
        DetailViewController *detailController = (DetailViewController *)[segue destinationViewController];

        detailController.department = [departmentsList objectAtIndex:[self.tableView indexPathForSelectedRow].row];
    }
}

A strange thing is that I can perform segue and go back for 5 times. On the 5th time my DetailViewController appears with empty table, and on 6th time I get an exception described above.

I've found a lot of similar questions on SO, but there was no working solution for me.

Don't know what might be wrong? Any suggestions where to look ?

Oleg
  • 2,984
  • 8
  • 43
  • 71

1 Answers1

0

I've add odd problems like this when going back an forth on a navigation controller. It my case it was keyboard problems.

For me, it turned out that my detail view controller was getting reused. I think this is a new feature in Xcode 4.5 or iOS 6 to attempt to keep the number of nib loads low. I didn't clean up after myself properly in -viewWillDisappear:/-viewDidDisappear:. The keyboard thought it was still showing, but wasn't.

I don't know if you are having a similar problem, but it might be worth looking into. Check and see if you are getting the same detail view controller object with each load. If so, then look to see if you are leaving the detail view controller in a bad state.

Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • My DetailViewControllers never go out from the memory. for each segue a new instance of DetailViewController is created. So in the end an app runs out of memory. This is what I've realized in Instruments tool. Any ideas what might be wrong ? – Oleg Oct 17 '12 at 16:24
  • If you are using ARC you have a stale reference. If you are not then you have missed a `-release`/`-autorelease`. Have you done an Analyze? – Jeffery Thomas Oct 17 '12 at 17:03
  • I use ARC.. very strange then – Oleg Oct 17 '12 at 17:46
  • Look to see if you have a strong IBOutlet that you haven't released in `-viewDidUnload`. Really, it could be anything that the view controller holds onto that is holding on to the view controller. – Jeffery Thomas Oct 17 '12 at 18:19