gpt4 book ai didi

ios - 为什么我的 segue 导致 "unrecognized selector sent to instance"NSInvalidArgumentException?

转载 作者:搜寻专家 更新时间:2023-10-31 22:09:53 24 4
gpt4 key购买 nike

尝试使用 segue 从我的第一个 ViewController 移动到我的第二个 ViewController(都使用相同的 Storyboard)。我的第一个 ViewController 有两个按钮,一个表示“男性”,一个表示“女性”(我知道,不是每个人都与这两个中的一个相关联),我希望其中一个按钮在单击后移动到第二个 ViewController。我将按钮拖/放到我的代码中以获得以下内容:

@IBAction func femaleButton(_ sender: AnyObject)
{
Globals.onboardingList.append("girl")
print("it's a girl!")
performSegue(withIdentifier: "femaleSegue", sender: self)
}

男性按钮是相同的。使用 printlines 我知道该程序一直运行到“performSegue”行。我添加了视觉转场并将它们的标识符设置为 maleSegue 和 femaleSegue。但是,我收到以下错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[Train.SecondVC
_setViewDelegateContentOverlayInsetsAreClean:]: unrecognized selector
sent to instance 0x7fc482d02b00'

非常感谢您的帮助!

最佳答案

在我的例子中,我得到这个错误是因为我创建了一个自定义的 ViewController 类,并错误地将它分配给 Storyboard 中的 View 而不是 ViewController。检查您的 Storyboard View 和 ViewControllers 是否有自定义类,并确保您已正确设置它们。

关于ios - 为什么我的 segue 导致 "unrecognized selector sent to instance"NSInvalidArgumentException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49502525/

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