I initialize an UINavigationController with my custom UIViewController subclass. But as soon as I want to present the view controller I get a SIGABRT error in Xcode. I have done this many times before and I assume that this problem existis because of other things that might not be correct in my current project. However, I find it very difficult to find the problem behind this phenomenon. So are there some things that you can do which somehow prevent the presentation of a modal view controller?
This is how I present my view controller:
- (IBAction)tutorialTouched:(id)sender {
TutorialViewController *tutorialVC = [[TutorialViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:tutorialVC];
nav.modalPresentationStyle = UIModalPresentationFormSheet;
// This line leads to `SIGABRT`
[self presentModalViewController:nav animated:NO];
}
Deployment target is 5.0.
Update:
This is the information I get when typing bt into the console:
#0 0x945919c6 in __pthread_kill ()
#1 0x9645bf78 in pthread_kill ()
#2 0x9644cbdd in abort ()
#3 0x003169dc in uncaught_exception_handler ()
#4 0x032010fc in __handleUncaughtException ()
#5 0x02f00f0f in _objc_terminate ()
#6 0x0349e8de in safe_handler_caller ()
#7 0x0349e946 in std::terminate ()
#8 0x0349fb3e in __cxa_rethrow ()
#9 0x02f00e15 in objc_exception_rethrow ()
#10 0x03137de0 in CFRunLoopRunSpecific ()
#11 0x03137c9b in CFRunLoopRunInMode ()
#12 0x035ca7d8 in GSEventRunModal ()
#13 0x035ca88a in GSEventRun ()
#14 0x016b3626 in UIApplicationMain ()
#15 0x00002fad in main (argc=1, argv=0xbffff5a8) at /Users/myProject/main.m:14
The problem was caused due to an Outlet error inside my ViewController. I could not figure it out because the compiler never told me this. Only when I added a
try / catcharound the presentation of the view controller did I get the exception object, which finally told me what was wrong. Sorry for the confusion and thanks for your help.