【问题标题】:PerformSegueWithIdentifier blowing upPerformSegueWithIdentifier 爆炸
【发布时间】:2020-08-14 19:00:29
【问题描述】:

我遇到了一个奇怪的情况。以下是我的布局的简要说明:

登录视图控制器 -> 主表视图控制器(具有注销按钮)-> 第二表视图控制器(具有注销按钮)-> 帮助菜单。

因此,当用户进入帮助菜单并单击注销按钮时,它会将它们转储回第二个视图控制器,此时它会爆炸说:

Thread 1: Exception: "Receiver (<xxx.SecondViewController: 0x7fa72b9cc040>) has no segue with identifier 'SignupViewController'"

注销按钮的代码如下:

@IBAction func btnLogoutPressed(_ sender: Any) {
        try! Auth.auth().signOut()
        performSegue(withIdentifier: "SignupViewController", sender: self)
    }

在 SecondViewController 中,我还有一个注销按钮,其代码与帮助视图控制器的代码完全相同。

知道如何解决这个问题吗?

【问题讨论】:

  • 你必须出示storyBoard的图片。并识别segues。不清楚 segue 连接的位置,但您的错误表明您的菜单 VC 没有到 SingnupViewController 的 segue。

标签: ios swift segue viewcontroller


【解决方案1】:

您必须在情节提要中将 SecondViewController 的 segue 添加到 SignupViewController,并将该 segue 标识符设置为“SignupViewController”。然后就可以了。

我想现在 segue 只能从 Main Table View Controller 到带有标识符“SignupViewController”的 SignupViewController,如果是这样,它只能在 Main Table View Controller 中工作。

【讨论】:

  • 我不确定我是否在关注您的第二条评论,我确实尝试从 SecondViewController 添加一个 segue 到 Signup,但它仍然爆炸。
  • 我的意思是你只有从 Main Tableviewcontroller 到 SignupViewController 而不是从 SecondViewController 到 Signup。但是,现在您已将 SecondViewController 的 segue 添加到 Signup。您是否将 segue 标识符设置为“SignupViewController”?如果能提供storyboard的截图就好理解了。
  • 知道了,Nandish,谢谢你的帮助,我错过了标识符。
猜你喜欢
  • 2011-10-05
  • 1970-01-01
  • 2022-01-18
  • 2013-02-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多