gpt4 book ai didi

ios - 发送到 destinationViewController 的无法识别的选择器

转载 作者:行者123 更新时间:2023-11-29 03:08:28 25 4
gpt4 key购买 nike

我的应用程序中的

UITableView 是使用 NSFetchedResultsController 进行管理的,我想实现主从行为,但每次我点击单元格时都会收到此 -[UIViewController setActivity:]: 无法识别的选择器发送到实例 0x176a7660 错误...

我不知道发生了什么,因为我的代码基于 Apple 的 Master-Detail 演示应用程序。这是prepareForSegue:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"activitySegue"]) {
ActivityDetailsViewController *advc = segue.destinationViewController;
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Activity *activity = (Activity *)[[self fetchedResultsController] objectAtIndexPath:indexPath];
[advc setActivity:activity];
}
}

当然,在destinationViewController中声明了@property。我认为这个 NSManagedObject 可能有问题,并且它没有正确传递到目的地......但这只是我的猜测。

最佳答案

看起来您的 Storyboard 中的 View Controller 类的名称没有设置为详细 View Controller ,因此 UIViewController 的实例被创建而不是 ActivityDetailsViewController 的实例.

将 Storyboard中 View Controller 的名称设置为ActivityDetailsViewController .

关于ios - 发送到 destinationViewController 的无法识别的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22503936/

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