gpt4 book ai didi

ios - 异常 'NSInternalInconsistencyException' ,原因 : 'Could not load NIB in bundle: . ..有人可以找出这有什么问题吗

转载 作者:行者123 更新时间:2023-11-29 11:51:37 24 4
gpt4 key购买 nike

error occurs with below code---Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
DetailViewController *dvc =[[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil];
dvc.index = indexPath.row;
[self.navigationController pushViewController:dvc animated:YES];

}

最佳答案

正如您在评论中提到的,您正在使用 Storyboard,那么这不是您使用 Storyboard 初始化 UIViewController 对象的方式。

你必须这样创建对象

DetailViewController *vcDetailViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"DetailViewController"];
vcDetailViewController.index = indexPath.row;
[self.navigationController pushViewController:vcDetailViewController animated:YES];

此外,您需要将 StoryBoard Id 提供给您的 View Controller ,检查图像

enter image description here

关于ios - 异常 'NSInternalInconsistencyException' ,原因 : 'Could not load NIB in bundle: . ..有人可以找出这有什么问题吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40882272/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com