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 Build a Blog Reader iPhone App Adapting Data for Display Formatting Dates with NSDateFormatter

Dwight Davis
PLUS
Dwight Davis
Courses Plus Student 9,120 Points

I need a bit of help with a NSNull error :-) (SOLVED ALREADY)

Solved :-) The problem was that I had blogPost.date = [bpDictionary objectForKey:@"thumbnail"]; instead of blogPost.date = [bpDictionary objectForKey:@"date"];

I am having a NSNull error that I have no idea where is coming from, since I followed the tutorial. Thank you so much for your help :-)

I am getting this error:

2014-05-22 15:07:01.623 BlogReader[3320:60b] __NSCFString 2014-05-22 15:07:01.703 BlogReader[3320:60b] __NSCFString 2014-05-22 15:07:01.794 BlogReader[3320:60b] -[NSNull length]: unrecognized selector sent to instance 0x193a068 (lldb)

In this line:

NSDate *tempDate = [dateFormatter dateFromString:self.date];

Which is in this method:

  • (NSString *) formattedDate{

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *tempDate = [dateFormatter dateFromString:self.date];

    [dateFormatter setDateFormat:@"EE MMM,dd"]; return [dateFormatter stringFromDate:tempDate];

}