Xcode 6 fast multiple cuts with segue preparation

I am currently working on an application with one core ViewControllerand 2 others ViewControllers.
One of them is my browser, which works fine, and the other - TableView.
I have 5 Buttonsthat lead me to my browser and one that should go to mine TableView.
I connected Buttonto the Existing Modified segue to my controller TableView(which is built in NavigationViewController).
But every time I try to press a 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)

This will not work if I connect my segue to another view manager or if I use other buttons.

, - , , , :

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 = "https://edumail.sh.ch/owa"

    }

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

        DestViewConroller.url = "http://kanti.sh.ch/fileadmin/Redaktoren/Service/Mensa/Menueplan.pdf"

    }

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

        DestViewConroller.url = "https://edu.sh.ch/Lists/Absenzen/Heute%20%20Knftige.aspx"

    }

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

        DestViewConroller.url = "https://edu.sh.ch/Informationen/Stundenplaene/SiteAssets/SitePages/Homepage/klassen_03_juli.pdf"


    }



}

+4
4

,

, , , quick segue.destinationViewController - WebViewController.

, destinationViewController WebViewController.

, tableViewController, .

, , DestViewController if , segue tableViewController, destinationViewController.

+2

, , - :

var webViewController = (segue.destinationViewController as?
 UINavigationController)?.viewControllers[0] as? webViewController
+1

segue/dynamic cast failed , .

webview UINavigationController, segue.destinationViewController UINavigationController, DestViewController.

, :

var DestViewConroller : WebViewController = segue.destinationViewController as WebViewController

:

var DestViewConroller : WebViewController = segue.destinationViewController.topViewController as WebViewController

.topViewController UINavigationController , DestViewConroller

+1

The problem, apparently, is the case. Make sure you set the class DestViewConrollerto WebViewControllerin the storyboard. If you do not, DestViewConroller will be considered an instance of the UIViewController, despite the cast.

0
source

All Articles