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.


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)