Jump to content

Crash when trying to change view in Xcode and swift 4

jake765111

I am trying to switch view's by running this code

 let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

                let messagesController = storyBoard.instantiateViewController(withIdentifier: "MessagesController") as! MessagesController

                self.present(messagesController, animated:true, completion:nil)

 

However, when I do it does not change the views successfully. It says this, "Thread 1: signal SIGABRT"

018-12-17 08:30:13.807999-0500 Kind Point[7975:544937] Could not cast value of type 'Kind_Point.LoginController' (0x106c5bb70) to 'Kind_Point.MessagesController' (0x106c5b908).
(lldb)  2092432147_ScreenShot2018-12-17at7_52_53AM.png.18443114cf4a3f9639f2dc2defda0b08.png

 

 

I have an image of what the view controller I want it to switch to should look like

 

What should I do?

Did I fix your problem? Please feel free to donate to me at <Link Removed> 

Any donation is greatly appreciated! Thanks!

 

My pc - PCPartPicker part list 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

@jake765111

 

Can you provide more context, how exactly are you trying to switch between views?

 

Can you check if your LoginController class is properly linked in the storyboard as well?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×