1
votes

I need some help with this issue with segue, i have spent a lot of time and not able to figure it out. The error message i get is "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<#######Other_V3: 0x123d727d0>) has no segue with identifier 'OtherSubSegue_v3'). I have 2 view controllers Other_V3 and Other_Sub_V3. I am connecting these two with a segue and the identifier is "OtherSubSegue_v3". When i run the program and it crashes at "self.performSegue(withIdentifier: "OtherSubSegue_v3", sender: self)" I have a table view adde programatically. when certain cells are tapped i call the segue. Few Lines of code is below:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
    {
    If (indexPath.row == 2 || indexPath.row == 7 ) {
            print("inside")
            self.performSegue(withIdentifier: "OtherSubSegue_v3", sender: self)
        }
}
override func  prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if (segue.identifier == "OtherSubSegue_v3") {
            let index:IndexPath! = tableView.indexPathForSelectedRow
            let vc = segue.destination as! Other_Sub_V3
            vc.OtherSelectedOption = index.row
        }
    }

Attached is screen shot for the VC and segue, can anyone please let me know what i am missing here.

Segue Identifier VC 1 VC 2 VC 1 VC 2

1

1 Answers

1
votes

First tip is to ensure that your code is referencing the correct storyboard, sharing your code will help in this case.

secondly, how are you transitioning from one view to and other? Your views don't seem to have any transition method.

Also, since you are creating tableview by code, then you should do tableView.delegate=self; to set the delegate.

Here's an example of the segue identifier being used with a tableview.

segue identifier example