小编use*_*778的帖子

单击按钮后,无法识别的选择器发送到实例错误

我不确定为什么会出现此错误。当我单击FirstViewController上的按钮时会发生这种情况:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController 1ButtonPress:]: unrecognized selector sent to instance 0x10954bbd0'
Run Code Online (Sandbox Code Playgroud)

我的FirstViewController有一个按钮(1ButtonPress),它与另一个嵌入了NavigationController的ViewController进行选择(因此,在我的故事板中,选择是从FirstViewController到NavigationController)。在此SEGUE,一些数据被传输到由其他的ViewController:
First.m

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"abc"]) {
            UINavigationController *navController = [segue destinationViewController];
            SecondViewController *BVC = (SecondViewController *)(navController.topViewController);
        BVC.BLLImg = [UIImage imageNamed:@"SomeImage.jpg"];
        BVC.BLLTitle = @"SomeText";
    }

}
Run Code Online (Sandbox Code Playgroud)

该脚本在情节提要中具有标识符“ abc”。环顾四周,我认为它与不正确的类有关,但是第一次检查时一切看起来都很好。
还有其他原因导致我收到此错误?

objective-c uibutton ios unrecognized-selector

3
推荐指数
1
解决办法
4677
查看次数