gpt4 book ai didi

iphone - 如何调试 'unrecognized selector sent to instance' 问题?

转载 作者:行者123 更新时间:2023-12-03 18:41:54 25 4
gpt4 key购买 nike

我在 View Controller 中有以下代码(在所有其他方面)似乎工作正常:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ProblemViewController *problemViewController = [[ProblemViewController alloc] initWithNibName:@"ProblemViewController" bundle:nil];
problemViewController.problem = (Problem*)[self.problems objectAtIndex:indexPath.row];
[self.navigationController pushViewController:problemViewController];
[problemViewController release];
}

但是,当我运行此函数时,出现以下错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[ProblemViewController initWithNibName:bundle:]: unrecognized selector sent to instance 0x57ca80'

我不知道是什么原因造成的,所以我的问题是:我应该如何最好地调试这个问题?有什么明显的事情我应该检查吗?

最佳答案

检查 ProblemViewController 的基类。我敢打赌您不是从 UIViewController 继承,其中包括 initWithNibName:bundle: 方法。

关于iphone - 如何调试 'unrecognized selector sent to instance' 问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/622865/

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