I would like to select one cell in my TableViewController
. The text of the cell should be transferred via segue to FirstViewController's label. I always get the error shown below.
The identifier is correct.
My code:
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if (segue.identifier == "BackToCalculator") {
//let myRow = tableView.indexPathForSelectedRow().row+1
let vc = segue.destinationViewController as FirstViewController
vc.SelectedBundesland.text = "Test"
}
}
Exception:
0x103f1f5dc: jne 0x103f1f5d0 ; swift_dynamicCastClassUnconditional + 48 0x103f1f5de: leaq 0x3364d(%rip), %rax ; "Swift dynamic cast failed" 0x103f1f5e5: movq %rax, 0xa456c(%rip) ; gCRAnnotations + 8 0x103f1f5ec: int3
0x103f1f5ed: movq %r14, %rax
What is wrong?
FirstViewController
- have you checked that? Which is the line raising the exception? – Antonioas FirstViewController
cast, put a breakpoint in the next line and check what's the actual type ofvc
- I think that to do that you have to comment thevc.SelectedBunesland.text = "Test"
line out. – Antonio