Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios swift当前模式Segue exc错误指令_Ios_Swift_Segue - Fatal编程技术网

Ios swift当前模式Segue exc错误指令

Ios swift当前模式Segue exc错误指令,ios,swift,segue,Ios,Swift,Segue,所以我只是在学习Swift的基础知识。我有一个项目的表视图,当单击一个项目时,我想显示一个显示该特定项目详细信息的视图。我有下面的代码,我试图在其中实现这一点,虽然,我得到了一个错误的指令运行时错误。知道我哪里出错了吗?谢谢 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destinationViewControl

所以我只是在学习Swift的基础知识。我有一个项目的表视图,当单击一个项目时,我想显示一个显示该特定项目详细信息的视图。我有下面的代码,我试图在其中实现这一点,虽然,我得到了一个错误的指令运行时错误。知道我哪里出错了吗?谢谢

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.

    super.prepare(for: segue,sender: sender)

    switch(segue.identifier ?? "") {
    //the add item button is pressed
    case "AddItem":
        os_log("Adding a new donation.", log: OSLog.default, type: .debug)

    //an existing item is pressed
    case "ShowDetailDrill":

        guard let itemViewController = segue.destination as? ItemViewController else {
            fatalError("Unexpected destination: \(segue.destination)")
        }

        guard let selectedDonationItemCell = sender as? DonationItemCell else {
            fatalError("Unexpected sender: \(sender)")
        }

        guard let indexPath = tableView.indexPath(for: selectedDonationItemCell) else {
            fatalError("The selected cell is not being displayed by the table")
        }

        let selectedDonation = donatedItems.getItem(index: indexPath.row)

        //TODO: load this to SubmissionVC
        itemViewController.donatedItem = selectedDonation

    default:
        fatalError("Unexpected Segue Identifier; \(segue.identifier)")
    }

}

更新

我忘了说它在这里坏了


更新2:好的,所以我移除了导航控制器,并将segue从“现在模式”更改为“显示”。它直接从单元格到达项目控制器。现在一切都正常了,尽管我仍然有点困惑为什么它不能与导航控制器一起工作。如果有人能够解释原因,我会将其标记为答案。

ShowDetailDrill segue是否来自tableviewcell?如果是,请尝试删除它,然后从tableviewcontroller创建一个新的segue,改为ItemViewController

有些东西可能是零。它在哪一行崩溃?请共享您的错误日志。看看它在哪里崩溃。只是更新了问题。希望有帮助!