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! While you're at it, check out some resources Treehouse students have shared here.

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

iOS

Jason Sigmon
Jason Sigmon
9,776 Points

App Crashes After Adding Navigation Controller

Could anyone offer any suggestions for why my App sometimes crashes after adding the navigation controller? I get this message

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

It takes me to main.m and says that this line is the problem return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

Finally any suggestion why my App Delegate.m throws a warning after this line?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

}

Says "control reaches end of non void function. Thank You.

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Jason,

Check out the method signature of that code you pasted in. The very first thing we see (after the dash) is the return type, which in this case is BOOL. That means that the code in the curly braces must return a BOOL value. In this method all we need to do is add the line return YES;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    return YES;
}

It's basically answering the question, "Did the application finish launching with options?" ... "YES" ... "Okay, time to go on with the rest of the app..."