【问题标题】:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'Receiver()没有标识符的segue
【发布时间】:2015-05-08 06:19:38
【问题描述】:

我已经广泛搜索了这个问题,但没有任何建议对我有用。我对此也很陌生,所以问题可能是非常基本的。我正在尝试创建从表视图控制器到具有表视图的视图控制器的 segue。当我在模拟器中运行它时,当我单击一个单元格时它会崩溃并给我这个错误:由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'Receiver () has no segue with identifier。

这是我的代码:

var conditions = [Condition]()

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

    for Location in locations {
        for Condition in Location.conditions {
            conditions.append(Condition)
        }
    }
            let selectedCondition = conditions[indexPath.row]
            let destinationVC = TestTableViewController()
            destinationVC.condition = selectedCondition
            destinationVC.performSegueWithIdentifier("FirstSegue", sender: self)
}

我尝试在模拟器上删除应用程序,执行 Product -> clean,重命名情节提要,并且我确定 segue 的命名正确。

谢谢!

【问题讨论】:

    标签: xcode


    【解决方案1】:

    而不是destinationVC.performSegueWithIdentifier:,您想对自己执行它:self.performSegueWithIdentifier,因为呈现目的地的是演示者,而不是呈现自身的目的地。

    【讨论】:

      猜你喜欢
      • 2018-04-05
      • 1970-01-01
      • 2013-04-27
      • 2021-09-17
      • 2012-07-12
      • 2021-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多