Avineet Gupta
Avineet Gupta

Reputation: 596

NSBundle is Not Loading - ObjectiveC

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'WebViewController''

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if(self.webViewController == nil) {
        self.webViewController = [[WebViewController alloc] initWithNibName:@"WebViewController"
                                                                     bundle:[NSBundle mainBundle]];
    }
}

Thanks.

Upvotes: 0

Views: 143

Answers (3)

user4226071
user4226071

Reputation:

Check the following,

  1. WebViewController.xib exists in your project and spelled correctly in code, check the xib name is same as in your code. If file not exist, add it. If misspelled, update the code.

  2. It is listed in Copy Bundle Resources; if not add it.

Upvotes: 0

Meenakshi
Meenakshi

Reputation: 1162

I think, you have not chosen the target membership for your nib file. Tap on your nib file & check the Target membership for your nib file.

Upvotes: 2

l0gg3r
l0gg3r

Reputation: 8954

That's because the nib file with name WebViewController is missing in your bundle.
To make WebViewController.nib be produced in your bundle, you need to create a .xib interface file with name WebViewController.

enter image description here

Upvotes: 0

Related Questions