0

I have a UITableViewController that uses custom table view cells (and I have created an XIB for my custom UITableViewCell subclass)

When my app attempts to load the table view controller it crashes with the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/CoolDocsMan/Library/Application Support/iPhone Simulator/5.1/Applications/Z7BB7085F-37A7-4B92-89A3-37EC34531B08/FunkySpaces.app> (loaded)' with name 'AdminConfirmTableViewCell''

Following one of the suggestions in the post Could not load NIB in bundle, I checked the app folder in my Libraries by exploring contents of:

/Users/CoolDocsMan/Library/Application Support/iPhone Simulator/5.1/Applications/Z7BB7085F-37A7-4B92-89A3-37EC34531B08/FunkySpaces.app

I am using the same technique for other similar tableVCs but found that while all other XIB files were properly translated into .nib this specific tableview cell XIB got tranlated with an extra space at its end.

i.e. 'AdminConfirmTableViewCell .nib' instead of 'AdminConfirmTableViewCell.nib'

I did a global search in XCode to see if I had made a typo and inserted an extra space after AdminConfirmTableViewCell, but found none.

Here is section of code from the ViewDidLoad of the tableVC which contains the AdminConfirmTableViewCell:

//Load the NIB file
UINib *nib = [UINib nibWithNibName:@"AdminConfirmTableViewCell" bundle:nil];

//register this NIB whch containes the cell    
[[self tableView] registerNib:nib forCellReuseIdentifier:@"AdminConfirmTableViewCell"];

Thanks!

Community
  • 1
  • 1
CoolDocMan
  • 637
  • 7
  • 29

2 Answers2

0

this is my first answer in stack overflow! How about trying this, obviously customising to your needs

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

RootViewController *addController = [[RootViewController alloc]
                                      initWithNibName:@"nibnamehere" bundle:nil];

UINavigationController *navigationController = [[UINavigationController alloc]
                                                initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:NO];

[navigationController release];
[addController release];

}

  • thanks for taking the time to respond and congrats on putting up your first answer. I was looking for something specific to the extra space not a redesign :-) – CoolDocMan Jan 25 '13 at 16:35
0

I found the problem finally and understand now why it was not showing up when I scanned the code. The issue is actually in the way I specified the Custom Class for my custom UITableView cell (AdminConfirmTableViewCell) under Identity inspector in interface builder.

I had spelled out 'AdminConfirmTableViewCell ' with an extra space at the end in Identity Inspector under Custom Class...therefore the AdminConfirmTableViewCell.xib had this name with the extra space (see screenshot...) and while building, XCode translated this into a NIB file as 'AdminConfirmTableViewCell. nib' with an extra space.

On removing the extra space everything worked out! It appears quite unlike Apple to leave this gap in Interface Builder implementation which allows a developer to potentially make these kind of errors.

enter image description here

CoolDocMan
  • 637
  • 7
  • 29