0

I am new in iOS programming, someone just passed an iOS project to me and I was trying to run it. My first problem is with GoogleMaps missing file but I downloaded the GoogleMaps framework and re-import it in the project. My next problem is this: Terminating app due to uncaught exception 'NSInternalInconsistencyException'

enter image description here

And here's the output:

2015-11-16 16:24:43.834 appname[870:39308] -> connection established!
2015-11-16 16:24:43.884 appname[870:39308] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIApplication.m:3299
2015-11-16 16:24:43.899 appname[870:39308] *** 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:
(
    0   CoreFoundation                      0x0000000113c46f45 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001136c0deb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000113c46daa +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x000000011330d5ee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   UIKit                               0x0000000111d47f15 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3112
    5   UIKit                               0x0000000111d44ba3 -[UIApplication workspaceDidEndTransaction:] + 188
    6   FrontBoardServices                  0x0000000118437784 -[FBSSerialQueue _performNext] + 192
    7   FrontBoardServices                  0x0000000118437af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    8   CoreFoundation                      0x0000000113b73011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    9   CoreFoundation                      0x0000000113b68f3c __CFRunLoopDoSources0 + 556
    10  CoreFoundation                      0x0000000113b683f3 __CFRunLoopRun + 867
    11  CoreFoundation                      0x0000000113b67e08 CFRunLoopRunSpecific + 488
    12  UIKit                               0x0000000111d444f5 -[UIApplication _run] + 402
    13  UIKit                               0x0000000111d4930d UIApplicationMain + 171
    14  appname                             0x000000010ff42213 main + 99
    15  libdyld.dylib                       0x000000011412a92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
Jayson Tamayo
  • 2,741
  • 3
  • 49
  • 76
  • Possible duplicate of ["Application windows are expected to have a root view controller at the end of application launch" error when running a project with Xcode 7, iOS 9](http://stackoverflow.com/questions/30884896/application-windows-are-expected-to-have-a-root-view-controller-at-the-end-of-a) – vadian Nov 16 '15 at 09:01

2 Answers2

0

The exeption description is Application windows are expected to have a root view controller at the end of application launch
So set any view controller as a root in intreface bulder or in - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method in AppDelegate

evnaz
  • 190
  • 1
  • 8
0

In AppDelegate.m, under didFinishLaunchingWithOptions: method, set the root view controller as below:-

UIViewController *launchViewController = [UIViewController instantiateViewControllerWithIdentifier:@"LaunchViewController" fromStoryboard:@"Main"];

self.window=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
[self.window setRootViewController:launchViewController];
[self.window makeKeyAndVisible];

Note:- The identifier of your initial view controller may be different in your storyboard. So replace @"LaunchViewController" with your identifier value.

pkc456
  • 8,350
  • 38
  • 53
  • 109