Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?
So this also happened to me too. I checked 50 times and my "Is Initial View Controller" was checked, believe me. It happened out of the blue. So how did I fix it?
- Create a new Storyboard in your project, name it something like Main_iPhoneV2 (or iPadV2 depending on your original storyboard style)
- Open the broken storyboard, click anywhere in the white area and press command-a, then command-c (select all and copy)
- Open your new storyboard and press command-v to paste the same exact setup
- Go to your project settings, change your "Main Interface" to the new Main_iPhoneV2 (If it's your iPad and you're writing a universal app, you'll have to edit the -Info.plist and look for the value "Main storyboard file base name (iPad)
- Recompile, and stop pulling your hair out
Failed to instantiate the default view controller for UIMainStoryboardFile
Failed to instantiate the default view controller for
UIMainStoryboardFile 'Main' - perhaps the designated entry point is
not set?
This error happens due to a simple mistake in your storyboard. When your app starts, iOS needs to know precisely which view controller needs to be shown first – known as your default view controller.
To fix it, add a ViewController
to your Main.Storyboard
and set it as Inital View Controller
.
Refer: how-to-fix-the-error-failed-to-instantiate-the-default-view-controller-for-uimainstoryboardfile
And there are two SignInViewController
in your project.
Use this one:
public partial class SignInViewController : UIViewController
{
public SignInViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad()
{
// never gets called...
base.ViewDidLoad();
View.BackgroundColor = UIColor.Red;
}
}
Update:
Failed to instantiate the default view controller for UIMainStoryboardFile 'Main'
Select the ViewController Scene. Now, select the inspector panel from the sidebar options. Check the “Is Initial View Controller” attribute option, save the project and build the project again.
Programmatically set the initial view controller using Storyboards in Xcode 11.2
iOS 13 has moved the windows setup from AppDelegate
to SceneDelegate
to support the use of (possibly multiple) scenes rather than a single window. You now have to do the setup like this:
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
let storyboard = UIStoryboard(name: "Main", bundle: nil)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
let vc = storyboard.instantiateViewController (withIdentifier: "Primary") as! ViewController
window = UIWindow(windowScene: windowScene)
window?.rootViewController = vc
window?.makeKeyAndVisible()
}
Related Topics
Finish All Asynchronous Requests Before Loading Data
My Prerelease App Has Been "Processing" for Over a Week in Itunes Connect, What Gives
Swift 3.0 Error: Escaping Closures Can Only Capture Inout Parameters Explicitly by Value
Custom Installed Font Not Displayed Correctly in Uilabel
Change the Uitableviewcell Height According to Amount of Text
Xcode 4.5 and iOS 4.2.1 Incompatibility
Failed to Obtain a Cell from Its Datasource
How to Resize Uiimageview Based on Uiimage's Size/Ratio in Swift 3
iOS 13: Swift - 'Set Application Root View Controller Programmatically' Does Not Work
Ios: Sample Code for Simultaneous Record and Playback
Change Language in the App Programmatically in iOS
Uitableview Row Animation Duration and Completion Callback
Testing Corelocation on iPhone Simulator
Behaviour for Significant Change Location API When Terminated/Suspended
Use Multiple Font Colors in a Single Label
Cannot Change Search Bar Background Color
iOS Perform Action After Period of Inactivity (No User Interaction)