HungCLo HungCLo - 1 year ago 103
Swift Question

Can't change rootViewController in Appdelegate?

I design a soft Pin.

You can put 4 numbers twice and it will be your code. When you finished code assignment. The view will present segue (kind: Present Modally) to show another viewController.

Due to convenient, I would like to reset the View controller.

The Best way I found on the stack overflow is to reset rootViewController in the Appdelegate
Solution Here

When I follow the steps, I got an error below :

enter image description here

The Console shows :

enter image description here

Maybe the problem is the design in my storyboard

The upper one is original viewController

enter image description here

Can anyone figure out what's wrong with my code?

Thanks a lot!!!

Answer Source

The problem is from your Storyboard : you don't have a view controller with a StoryBoard ID EnterPinViewController.

Go to your Storyboard, select the controller and on side panel Utilities check the StoryBoard ID value.

Or change instantiateViewControllerWithIdentifier parameter with the one matching the Storyboard Identifier of your view controller.

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download