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

Downloading and parsing JSON Data

I keep getting this error message when i try to run the application in the simulator.

im not sure if i need to post my code but if its needed ill post it.

2013-07-27 21:48:10.544 BlogReader2[2915:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil' *** First throw call stack: (0x1c91012 0x10cee7e 0x1c90deb 0xc02f47 0x29ab 0xf41c7 0xf4232 0x433d5 0x4376f 0x43905 0x4c917 0x1096c 0x1194b 0x22cb5 0x23beb 0x15698 0x1becdf9 0x1becad0 0x1c06bf5 0x1c06962 0x1c37bb6 0x1c36f44 0x1c36e1b 0x1117a 0x12ffc 0x254d 0x2475) libc++abi.dylib: terminate called throwing an exception (lldb)

3 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Rashii Henry as David Kaneshiro Jr. mentioned try adding an exception breakpoint. It will halt execution of your app at the line where the error occurs.

Here's how you can add the exception breakpoint:

i have a few questions. if i add an exception breakpoint..

what is that actually doing for my code?

whenever an error occurs is that always the solution?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

An exception occurs when you get a runtime error within your code. By default Xcode simply stops the execution of your app but not at the file/line number where the error occurred. An exception breakpoint tells Xcode to add a breakpoint and halt execution whenever an exception occurs. This way you can see exactly at which line you have an error and can remedy the problem.

Really wish there was a kudos for the forums. That's a great little trick Amit! Thanks!

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Ken Barlo you certainly can upvote a post and even mark it as the best answer ;)

Ah! I didn't see it there. That's definitely worth an upvote! :)

try to surround the entire code block with try catch blocks, coz it clearly says you are not catching the exception on the first line. After catching the exception you will have a better idea of the cause, I guess.

not to familiar with try and catch methods. thats the problem.

It keeps referring to my app delegate.

import <UIKit/UIKit.h>

import "AppDelegate.h"

int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }

Dude I jus took a guess by reading the first line of your error message, I know nothing of iOS development or Objective C. Sorry.

P.S. If no one replies then email your query to "help@teamtreehouse.com"

I just watched this video today:

http://teamtreehouse.com/library/ios-development/build-a-blog-reader-iphone-app/adapting-data-for-display/handling-malformed-data

Around time index 2:25 Amit talks about adding an exception breakpoint to find the function that is throwing an exception he was getting in the video. Hopefully it do the same for you and will set a breakpoint on the function that is throwing the exception.