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 trialreardelt
8,030 PointsGetting "null" when logging the NSData object.
My code is shown here, http://paste.ofcode.org/Fg3ftS3nsZT4RMMrvErCvJ
When I NSLog the NSData object, I get null, I believe I have the url correct. What could be the issue?
2 Answers
Dan Paschevici
4,013 PointsTry to add between NSData and NSLog this 2 lines of code:
NSError *error = nil; NSDictionary *data = [NSJSONSerialization JSONObjectWithData:theData options:0 error:&error];
And you make an NSLog to retrieve "data" ( NSLog(@"%@", data); )
reardelt
8,030 PointsI think I skipped this part if I remember correctly
reardelt
8,030 Pointsreardelt
8,030 PointsHi Dan, That is giving me an error as well because NSData is null and it can't serialise a null object.
Benjamin McMahan
6,679 PointsBenjamin McMahan
6,679 PointsDid you ever resolve this? I can't get past this part, same problem. I am using the exact code as in the video and the URL is valid, I even tested others.