mardi 27 janvier 2015

Xcode 6 swift multiple segues with prepare for segue

Im currently working on an app with one main view controller and 2 other view controllers. One is my browser which is working fine and the other one is a table view. I have 5 buttons which lead me to my browser and one which should go to my table view. I've connected the button with a "present modally" segue to my table view controller(which has embed in a NavigationViewController. But every time I try to push the button the simulator crashes and this error appears:



libswiftCore.dylib`swift_dynamicCastClassUnconditional:
0x10b9bf860: pushq %rbp
0x10b9bf861: movq %rsp, %rbp
0x10b9bf864: testq %rdi, %rdi
0x10b9bf867: je 0x10b9bf89e ; swift_dynamicCastClassUnconditional + 62
0x10b9bf869: movabsq $-0x7fffffffffffffff, %rax
0x10b9bf873: testq %rax, %rdi
0x10b9bf876: jne 0x10b9bf89e ; swift_dynamicCastClassUnconditional + 62
0x10b9bf878: leaq 0xb52e9(%rip), %rax
0x10b9bf87f: movq (%rax), %rax
0x10b9bf882: andq (%rdi), %rax
0x10b9bf885: nopw %cs:(%rax,%rax)
0x10b9bf890: cmpq %rsi, %rax
0x10b9bf893: je 0x10b9bf8ad ; swift_dynamicCastClassUnconditional + 77
0x10b9bf895: movq 0x8(%rax), %rax
0x10b9bf899: testq %rax, %rax
0x10b9bf89c: jne 0x10b9bf890 ; swift_dynamicCastClassUnconditional + 48
0x10b9bf89e: leaq 0x36b7d(%rip), %rax ; "Swift dynamic cast failed"
0x10b9bf8a5: movq %rax, 0xb4c0c(%rip) ; gCRAnnotations + 8
0x10b9bf8ac: int3
0x10b9bf8ad: movq %rdi, %rax
0x10b9bf8b0: popq %rbp
0x10b9bf8b1: retq
0x10b9bf8b2: nopw %cs:(%rax,%rax)


It won't work as well if I connect my segue to another viewcontroller or if I'm using other buttons.


I know the problem is somewhere in this code because if I delete it everything works just fine:


` override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {



var DestViewConroller : WebViewController = segue.destinationViewController as WebViewController



if (segue.identifier == "homeSegue"){

DestViewConroller.url = "https://edu.sh.ch"


}

if (segue.identifier == "mailSegue"){

DestViewConroller.url = "http://ift.tt/1CK6ozv"

}

if (segue.identifier == "mensaSegue"){

DestViewConroller.url = "http://ift.tt/1yrgq1V"

}

if (segue.identifier == "absenzenSegue"){

DestViewConroller.url = "http://ift.tt/1yrgrmm"

}

if (segue.identifier == "stundenplanSegue"){

DestViewConroller.url = "http://ift.tt/1yrgqif"


}



}


`


Thanks in advance




Aucun commentaire:

Enregistrer un commentaire