Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
UISplitViewController in Xcode
Hey Guys, Im in Xcode with a split view controller and all my code is great without any issues, and i have a home screen before my split view, and when i run the app, and click on a link to go to the split view, it crashes and comes up with the main.main file, and i checked all the links in the Main.Storyboard and they are all good, nothing wrong there, i added an exemption break point, that didn't reveal anything but the same main,main file, and than i tried resetting the Simulator, and still, the same problem, does anyone know where i went wrong or what i can do to try and fix my problem?
Stone Preston42,016 Points
Ok, then there is your problem right there
reason: 'Application tried to present a Split View Controllers modally Basically you need to make the split view controller the root view controller before presenting it using something like
self.window.rootViewController = self.splitViewController;
Stone Preston this is exactly what it says
2014-04-09 13:46:11.745 iFormula[733:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a Split View Controllers modally <ViewController: 0x109422bf0>.' *** First throw call stack: ( 0 CoreFoundation 0x000000010194f495 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001016ae99e objc_exception_throw + 43 2 UIKit 0x000000010035bc93 -[UIViewController presentViewController:withTransition:completion:] + 4027 3 UIKit 0x000000010025cf06 -[UIApplication sendAction:to:from:forEvent:] + 80 4 UIKit 0x000000010025ceb4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17 5 UIKit 0x0000000100339880 -[UIControl _sendActionsForEvents:withEvent:] + 203 6 UIKit 0x0000000100338dc0 -[UIControl touchesEnded:withEvent:] + 530 7 UIKit 0x0000000100293d05 -[UIWindow _sendTouchesForEvent:] + 701 8 UIKit 0x00000001002946e4 -[UIWindow sendEvent:] + 925 9 UIKit 0x000000010026c29a -[UIApplication sendEvent:] + 211 10 UIKit 0x0000000100259aed _UIApplicationHandleEventQueue + 9579 11 CoreFoundation 0x00000001018ded21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 12 CoreFoundation 0x00000001018de5f2 __CFRunLoopDoSources0 + 242 13 CoreFoundation 0x00000001018fa46f __CFRunLoopRun + 767 14 CoreFoundation 0x00000001018f9d83 CFRunLoopRunSpecific + 467 15 GraphicsServices 0x0000000103ac6f04 GSEventRunModal + 161 16 UIKit 0x000000010025be33 UIApplicationMain + 1010 17 iFormula 0x0000000100003813 main + 115 18 libdyld.dylib 0x0000000101fe75fd start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)