ios - Swift dynamic cast failed when adding a new View Controller -
I have a simple iOS testing app in Swift. I have added an additional view controller at the beginning of my storyboard and a square LoginViewController has been created: UIViewController I have set my visual controller to be the custom class LoginViewController and changed the properties to make it the initial view controller.
I have also added a simple button which I have for the rest of the app.
Now when I start my app in the simulator, it immediately crashes with the following:
libswiftCore.dylib`swift_dynamicCastClassUnconditional: 0x10cc3f9e0: pushq% RBP 0x10cc3f9e1 : Movq% rp,% rbp 0x10cc3f9e4: testq% RDI,% RDI 0x10cc3f9e7: je 0x10cc3fa1e; Svift_dynamicstclassunkdishnl + 62 0x10cc3f9e9: Movabshk $ -0x7fffffffffffffff% Raks 0x10cc3f9f3: Testk% Raks% Rdi 0x10cc3f9f6: newborn 0x10cc3fa1e; Swift_dynamicCastClassUnconditional + 62 0x105x9f8: leaq 0xb5109 (% rip),% rax 0x10cc3f9ff: movq (% rax),% rax 0x10cc3fa02: andq (% rdi),% rax 0x10cc3fa05: nopw% cs: (% rax,% rax) 0x10cc3fa10: cmpq % Rsi,% rax 0x10cc3fa13: J0x10cc3fa2d; Svift_dynamicstclassunkdishnl + 77 0x10cc3fa15: Movk 0x8 (% Raks)% Raks 0x10cc3fa19: Testk% Raks% Raks 0x10cc3fa1c: newborn 0x10cc3fa10; Swift_dynamicCastClassUnconditional + 48 0x10cc3fa1e: Leaks 0x36b3d (% RIP),% rax; "Swift dynamic cast failed" 0x10cc3fa25: movq% rax, 0xb4a2c (% rip); gCRAnnotations + 8 0x10cc3fa2c: 0x10cc3fa2d int3: movq% RDI,% Rax 0x10cc3fa30: popq% RBP 0x10cc3fa31: retq 0x10cc3fa32:% CS nopw: (% Rax,% Rax)
I clearly Have missed a simple stage, just do not know what it is!
I can find the following error:
swift_dynamicCastClassUnconditional
Swift dynamic cast failed
Problem code: I was using Credentials Setting ViewController every time when connecting to various segue
// programming mark ----- ----- --------- ----- ------------- ---- Override Function Ready ForSegue (Segue: UIStoryboardSegue, From: AnyObject! ) {Var detailController = segue.destinationViewControllerCredentialsSetting; DetailController.viewControllerType = self.viewControllerType} // end prepareForSegue
Solution: It is to the solution I added specific conditions to move to segue to differennt connection:
// Programming Mark ------------------- ----- --------- ----- - --- Prepare override func FORSegue (Segue: UIStoryboardSegue, From: AnyObject!) {If self.viewControllerType == "Donothew Password" || Self.viewControllerType == "Forgot Password" {var detailController = segue.destinationViewControllerCredentialsSetting; DetailController.viewControllerType = self.viewControllerType}} / / end ready FORSegue
Comments
Post a Comment