Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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..."