1

I am receiving the following error every single time I run my app. It goes to my main.m file and highlights in RED:

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

It also says Thread 1: signal SIGABRT and in the output it says: * Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.29.5/UIApplication.m:3299 2015-11-10 22:54:13.484 TaskR Pro[7964:2256505] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch' *** First throw call stack: (0x1835e4f48 0x198197f80 0x1835e4e18 0x1844d8a1c 0x188e20414 0x188e1cf50 0x18d4037c4 0x18d403b44 0x18359c544 0x18359bfd8 0x183599cd8 0x1834c8ca0 0x188be61c8 0x188be0ffc 0x1000d6ca0 0x1989e68b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

How can I fix this?

1 Answers1

0

It tells you exactly what's the problem:

Application windows are expected to have a root view controller at the end of application launch

If you use a standard storyboard based template everything is set up already for you and you go straight to Main.storyboard. However if you replaced that one you should make sure it's marked as the first storyboard and also has a initial view controller marked (I will make some screenshots for you to make it more clear).

First set up your target's Main Interface like this:

enter image description here

Then set up your storyboard (Main in this case) as initial view controller:

enter image description here

If you don't use storyboards or you want to choose which one will be used at boot (maybe you want to do something different when there's no session) you should set up code in AppDelegate to do so, for example like the answer here.

Community
  • 1
  • 1
Lucas van Dongen
  • 9,328
  • 7
  • 39
  • 60