I am getting an error while I tried to push ViewController in table's didSelectRow in iPad app.
Error which I get is:
** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle: 'NSBundle /Users/abc/Library/Appl开发者_运维技巧ication
Support/iPhone Simulator/4.2/Applications/CFC7803E-4E44-45BF-9F47-``E24DDB44F286/SampleIpad.app> (loaded)' with name 'DetailView''
Code in table's didSelectRow
method :
DetailView *detailViewController = [[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
What can be done?
To do so, Right click the viewController .m file in Xcode
Click GetInfo
Go to Targets tab and check if the checkbox next to your target project is checked? If not, do check that checkbox.
Clean and Rebuild your code.
This would work for you.
This error is due to the missing nib file.Check whether your application folder on the disk contains the DetailView.xib file. If it is present you may try using [NSBundle mainBundle]
instead of nil in the bundle parameter.
Try this
[NSBundle mainBundle];
精彩评论