Search code examples
swiftuistoryboardsegue

Thread 1: Signal SIGABRT with segue in swift


I have several tableview. I am trying to make a simple application and after adding more view when I get the third tableView this error "Thread 1 Signal SIGABRT" and the app wont open in iOS Simulator. The error points to this line of code:

let VC :DetailCityTableViewController = segue.destinationViewController as! DetailCityTableViewController

and display error :

 Could not cast value of type 'UITableViewController' (0x102af47f8) to 'balen.DetailCityTableViewController' (0x1013d7560).
(lldb)  

Full Code :

tableview2 pass to tableView3

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    let path : NSIndexPath = self.tableView.indexPathForSelectedRow!

    if segue.identifier == "DetailCitySegue" {

        let VC :DetailCityTableViewController = segue.destinationViewController as! DetailCityTableViewController
        VC.urlDetailCity = urlDetail!// pass url city

        VC.cityIdSelectet =  cityId[path.row] //pas CountryID selected

        print(cityId[path.row])
    }           
}

I am , I think the problem is segue .What do you think?


Solution

  • No, the problem is '

    Could not cast value of type 'UITableViewController' (0x102af47f8) to 'balen.DetailCityTableViewController''

    You didn't change the class type of the view controller to DetailCityTableViewController in interface builder or the segue has a different destination than you think.