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!

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


Code Challenge - Formatting Dates with NSDateFormatter

I'm having this problem in Code Challenge - Formatting Dates with NSDateFormatter.

How do I get 10 days in advance using NSDate object? I've tried to use dateByAddingTimeInterval: but still to no avail. Here's the error snapshot

I really appreciate for the help!

4 Answers

Which line is causing the compile error? I'm pretty experienced with Objective-C and I'd be happy to help you via screen sharing on Screenhero, feel free to add me:


Hey! I've downloaded ScreenHero. Are you available now on ScreenHero? And I've added you already.

Hey, it looks like we solved the problem! For all others that are stuck on this, dateByAddingTimeInterval is an instance method, and so you have to call it on an instance variable, not on the class.

I really appreciate it :)

Great to have a pro here in the forums. Welcome J Sherwani!

Brett Kim
Brett Kim
11,576 Points

Also, J Sherwani , there's also NSDate *futureDate = [NSDate dateWithTimeIntervalSinceNow:secondsPerDay*10]; which works too. It's just a Treehouse compiler error (no spaces allowed)